Created Examples (markdown)

Benoît Blanchon
2015-07-05 22:48:59 +02:00
parent 8542b32cec
commit 9c9dc3e149

26
Examples.md Normal file

@@ -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.