mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Updated example
This commit is contained in:
@@ -22,17 +22,15 @@ Features
|
|||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
JsonParser<32> parser;
|
||||||
char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
|
char json[] = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
|
||||||
|
|
||||||
JsonParser<32> parser;
|
JsonHashTable root = parser.parse(json);
|
||||||
|
|
||||||
JsonHashTable root = parser.parseHashTable(json);
|
char* sensor = root["sensor"];
|
||||||
|
long time = root["time"];
|
||||||
char* sensor = root.getString("sensor");
|
double latitude = root["data"][0];
|
||||||
|
double longitude = root["data"][1];
|
||||||
long time = root.getLong("time");
|
|
||||||
|
|
||||||
JsonArray coords = root.getArray("data");
|
|
||||||
|
|
||||||
|
|
||||||
How to use ?
|
How to use ?
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ void setup()
|
|||||||
|
|
||||||
JsonParser<16> parser;
|
JsonParser<16> parser;
|
||||||
|
|
||||||
JsonValue root = parser.parse(json);
|
JsonHashTable root = parser.parse(json);
|
||||||
|
|
||||||
if (!root.success())
|
if (!root.success())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user