I am having trouble with reading nested json lists. I used the following code:
import rhinoscriptsyntax as rs
import json
import ghpythonlib.components as ghcomp
import ghpythonlib.treehelpers as gt
attr = json.loads(parameters)
#extraxt parameters
D1 = attr["D1"]
test = gt.list_to_tree(D1)
#different approach
H2 = json.dumps(attr)
H3 = H2[1]
The inputted Json input contains two nested json lists, but when I look at what “test” outputs the two lists are put together. How can I get this this attribute data sorted as it was inputted (in two seperated data trees). So in this case that would mean 6 branches.
If I want to slpit the tree, like with the gh SplitTree component How can I make this work in Python.
Somehow I do not manage with invoking the grasshopper function in python.
I’d suggest doing the splitting on the Python list (i.e. using its native functionality) before converting it to a DataTree. Mixing paradigms like this usually gets quite messy/verbose!