question

Yue Y avatar image
0 Likes"
Yue Y asked Yue Y answered

create a temporary treenode to hold json object

I am following this post https://answers.flexsim.com/questions/27069/how-to-read-or-write-json-data-in-flexsim.html to use json serializer and deserializer. In the example given in post, the treenode used to hold json object is retrieved from the model. Is there any way to create a temporary treenode on the fly using FlexScript to hold the output of json deserializer?

FlexSim 19.1.1
json
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Yue Y avatar image
2 Likes"
Yue Y answered

Solved.

We can use treenode.subnodes.assert() to create a new node and pass this node into jsonToTree().

treenode test = model().subnodes.assert("test");
string input = "{\"key\":[1,2]}";
jsonToTree(input, test);
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.