-->
Page 1 of 1

Problem parsing Json

PostPosted: Wed Feb 15, 2017 2:33 pm
by bradLarson
I'm grabbing data from an online MySQL DB using PHP which encodes the data into Json. The problem I'm having is that ArduinoJson library doesn't like the format in which my data is presented and won't parse it. I noticed mine doesn't have the backslash('\') that is used in the example code for ArduinoJson.

Here's an example of my output
Code: Select all[{"status":"2","ULevel":"3","LLevel":"2","cLevel":"4","MacAddress":"1","datetime":"2017\/02\/14 15:54:34","firmware":"38"}]


Here's the example from the ArduinoJson example code
Code: Select all"{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"


I'm wondering if this is a version issue or how my data is being encoded?

Re: Problem parsing Json

PostPosted: Thu Feb 16, 2017 4:11 pm
by gdsports
Paste your JSON in the INPUT box then copy the sample code in the Parsing Program window.

https://bblanchon.github.io/ArduinoJson/assistant/

The extra backslashes are required when storing JSON as a string constant in source code. The backslashes are not present in buffer.

Re: Problem parsing Json

PostPosted: Thu Feb 16, 2017 8:01 pm
by bradLarson
Thanks for the quick reply and the link to a nice tool!