I'm working on taking a json file...
contents:
{"mode":"1","xval":"48","yval":"54","udlr":"","cmdVal":""}
And using the aJson library to parse the variables out.
I'm grabbing the content of the file (including brackets) into a char array and using the following code:
Serial.print("json data: ");
Serial.println(json_data);
aJsonObject* jsonObject = aJson.parse(json_data);
aJsonObject* mode = aJson.getObjectItem(jsonObject , "mode");
Serial.print("Mode: ");
Serial.println(mode->valuestring);
aJsonObject* xval = aJson.getObjectItem(jsonObject , "xval");
Serial.print("Xval: ");
Serial.println(xval->valuestring);
My serial output shows that the char array is correct, and the code pulls out variables a couple times but then stops pulling them out. Here is my output from the above:
Connect to 173.255.229.121:80
json data: {"mode":"1","xval":"48","yval":"54","udlr":"","cmdVal":""}
Mode: 1
Xval: 48
Connect to 173.255.229.121:80
json data: {"mode":"1","xval":"48","yval":"54","udlr":"","cmdVal":""}
Mode: 1
Xval: 48
Connect to 173.255.229.121:80
json data: {"mode":"1","xval":"48","yval":"54","udlr":"","cmdVal":""}
Mode:
Xval:
Connect to 173.255.229.121:80
json data: {"mode":"1","xval":"48","yval":"54","udlr":"","cmdVal":""}
Mode:
Xval:
Any ideas as to why the parser would work a few times and then stop working?
Thanks!!