mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-17 11:31:12 +02:00
Updated Quick Start (markdown)
@@ -2,6 +2,7 @@
|
||||
|
||||
#### Decoding / Parsing
|
||||
|
||||
```c++
|
||||
char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
|
||||
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
@@ -12,11 +13,13 @@
|
||||
long time = root["time"];
|
||||
double latitude = root["data"][0];
|
||||
double longitude = root["data"][1];
|
||||
```
|
||||
|
||||
[See complete guide](../Decoding-JSON)
|
||||
|
||||
#### Encoding / Generating
|
||||
|
||||
```c++
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
|
||||
JsonObject& root = jsonBuffer.createObject();
|
||||
@@ -30,5 +33,6 @@
|
||||
root.printTo(Serial);
|
||||
// This prints:
|
||||
// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
|
||||
```
|
||||
|
||||
[See complete guide](../Encoding-JSON)
|
Reference in New Issue
Block a user