this is part which parase json data
JsonObject& root = jsonBuffer.parseObject(jsondata);
for (auto kv : root) {
Serial.println(kv.key);
Serial.println(kv.value.as<char*>());
}
anbu123:
yes here i used #include <ArduinoJson.h> library
this is part which parase json data
JsonObject& root = jsonBuffer.parseObject(jsondata);
for (auto kv : root) {
Serial.println(kv.key);
Serial.println(kv.value.as<char*>());
}
it is "parse" not "parase"
at this point you may be encouraged by forum members to post your code so people could diagnose your problem...
You have to properly structure the JSON data. The last attempt produces an anonymous array of objects. Don't do that. Produce a named array of objects.
{"topLevel":
     [
      {"name":"Switch 1","status":0,"id":1},
      {"name":"Switch 2","status":1,"id":2},
      {"name":"Switch 3","status":0,"id":3},
      {"name":"Switch 4","status":0,"id":4}
     ]
}
PaulS:
You have to properly structure the JSON data. The last attempt produces an anonymous array of objects. Don't do that. Produce a named array of objects.
help me!
i try parsing json with serial input arduino, and i input in serial it:
{"id":"1","stat":"on"}{"id":"2","stat":"off"}{"id":"3","stat":"off"}{"id":"4","stat":"on"}
this is my arduino program:
#include <ArduinoJson.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
delay(2000);
}