interactive-matter / aJson

aJson is an Arduino library to enable JSON processing with Arduino. It easily enables you to decode, create, manipulate and encode JSON directly from and to data structures.
http://interactive-matter.org/2010/08/ajson-handle-json-with-arduino/
566 stars 136 forks source link

json object in json array #87

Open EkaCreativeSolutions opened 7 years ago

EkaCreativeSolutions commented 7 years ago

Is possible add one or more json object in a json array?

rvdende commented 7 years ago

aJsonObject* root = aJson.createArray();

aJsonObject* day; day=aJson.createItem("Monday"); aJson.addItemToArray(root, day);

bltDefender commented 6 years ago

I would like to add a more complex object:

aJsonObject root = aJson.createObject(); aJsonObject logicalDevices = aJson.createArray(); aJsonObject* device = aJson.createObject(); aJson.addStringToObject(device, "command" , "setColor"); aJson.addItemToArray(logicalDevices, device); aJson.addItemToObject(root, "devicelist" logicalDevices);

Doing so results in a broken JSON tree. Any way to do this? Or does this break JSON schema?