Improved the example

This commit is contained in:
Benoit Blanchon
2014-07-05 13:10:07 +02:00
parent 757c86ddc5
commit efd8c0ff5c

View File

@ -1,5 +1,5 @@
/* /*
* Arduino JSON library * Arduino JSON library - Generator example
* Benoit Blanchon 2014 - MIT License * Benoit Blanchon 2014 - MIT License
*/ */
@ -11,22 +11,20 @@ void setup()
{ {
Serial.begin(9600); Serial.begin(9600);
JsonHashTable<3> h; JsonHashTable<3> json;
h.add("pi", 3.14159265358979323846, 4); json.add("sensor", "gps");
json.add("time", 1351824120);
JsonArray<3> a; JsonArray<3> array;
a.add(1); array.add(48.756080, 6);
a.add(2); array.add(2.302038, 6);
a.add(3); json.add("data", array);
h.add("list", a);
h.add("hello", "world"); Serial.print(json); // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
Serial.print(h);
} }
void loop() void loop()
{ {
} }