From efd8c0ff5cdba91952c6e9d30f1577f33b234f84 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Sat, 5 Jul 2014 13:10:07 +0200 Subject: [PATCH] Improved the example --- .../JsonGeneratorExample.ino | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/examples/JsonGeneratorExample/JsonGeneratorExample.ino b/examples/JsonGeneratorExample/JsonGeneratorExample.ino index d83d36c0..beea8e6f 100644 --- a/examples/JsonGeneratorExample/JsonGeneratorExample.ino +++ b/examples/JsonGeneratorExample/JsonGeneratorExample.ino @@ -1,5 +1,5 @@ /* - * Arduino JSON library + * Arduino JSON library - Generator example * Benoit Blanchon 2014 - MIT License */ @@ -11,22 +11,20 @@ void setup() { 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; - a.add(1); - a.add(2); - a.add(3); - h.add("list", a); + JsonArray<3> array; + array.add(48.756080, 6); + array.add(2.302038, 6); + json.add("data", array); - h.add("hello", "world"); - - Serial.print(h); + Serial.print(json); // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} } void loop() { -} +} \ No newline at end of file