Parsing nested json

but that doesn’t explain how to create JSON trees.

I saw this post: Construct var programmatically and convert to JSON

and pneyrink created this helper method:

void varSetProperty(var& object, String key, var value){
    if (object.isObject() {
        object.getDynamicObject()->setProperty(key, value);
   }
}

with the following usage:

var myJSONObject(new DynamicObject());
varSetProperty(myJSONObject, "name", "Jules");
1 Like