diff --git a/Examples.md b/Examples.md new file mode 100644 index 0000000..78589c8 --- /dev/null +++ b/Examples.md @@ -0,0 +1,26 @@ +## Example 1: complex nested object + +From [issue #85](https://github.com/bblanchon/ArduinoJson/issues/85): + + [ + { + "error": { + "address": "", + "description": "link button not pressed", + "type": "101" + } + } + ] + +Can be generated by the following code: + + DynamicJsonBuffer jsonBuffer; + JsonArray& root = jsonBuffer.createArray(); + JsonObject& error = root.createNestedObject().createNestedObject("error"); + error["address"] = ""; + error["description"] = "link button not pressed"; + error["type"] = "101"; + root.prettyPrintTo(Serial); + +Don't forget to replace the `DynamicJsonBuffer` by a `StaticJsonBuffer` if you need to run on an embedded platform like an Arduino. +