I'm parsing JSON in my Arduino sketch and having issues. I think it has to do with escaping characters but not sure. I'm calling the web service from Adafruit QT PY using Python without any issues.
String wsResponse = clientHTTP.responseBody();
Serial.print("response: ");
Serial.println(wsResponse);
//prints {\"ResponseCode\":1,\"ResponseMessage\":\"Success\",\"LogID\":13106}
StaticJsonDocument<200> jsonBuffer; //40 is probably enough
char json[wsResponse.length()+1];
wsResponse.toCharArray(json, wsResponse.length()+1);
DeserializationError error = deserializeJson(jsonBuffer, json);
int wsResponseCode = jsonBuffer["ResponseCode"];
if test with the following text it works as expected
String wsResponse = "{\"ResponseCode\":1,\"ResponseMessage\":\"Success\",\"LogID\":13106}";
There are backslashes in the text, not sure why will display
JSON Parse issue
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
Please be positive and constructive with your questions and comments.