but the app show warn with the message:
aws_iot: Failed to parse JSON: -1
aws_iot: Received JSON is not valid
looking through the code, find that the warining message is send from the file aws_iot_shadow_json.c in the function isJsonValidAndParse() when you try to parse json doc with jsmn.
I printed the json doc received when the warning occurred and the message received was:
Hi,
I am trying to receive a shadow with the following in aws:
{ "desired": { "action": "on", "config": { "pages": [ { "buttons": [ { "functionality": 0, "color": "gray", "brightness": 7 }, { "functionality": 0, "color": "red", "brightness": 7 }, { "functionality": 0, "color": "blue", "brightness": 7 }, { "functionality": 0, "color": "magenta", "brightness": 7 }, { "functionality": 0, "color": "lime", "brightness": 7 }, { "functionality": 0, "color": "yellow", "brightness": 7 }, { "functionality": 0, "color": "cyan", "brightness": 7 }, { "functionality": 0, "color": "white", "brightness": 7 } ] } ] } }, "reported": { "connected": true, "version": { "mayor": 0, "minor": 0, "patch": 2, "tag": "dev" } }, "delta": { "action": "on", "config": { "pages": [ { "buttons": [ { "functionality": 0, "color": "gray", "brightness": 7 }, { "functionality": 0, "color": "red", "brightness": 7 }, { "functionality": 0, "color": "blue", "brightness": 7 }, { "functionality": 0, "color": "magenta", "brightness": 7 }, { "functionality": 0, "color": "lime", "brightness": 7 }, { "functionality": 0, "color": "yellow", "brightness": 7 }, { "functionality": 0, "color": "cyan", "brightness": 7 }, { "functionality": 0, "color": "white", "brightness": 7 } ] } ] } } }
but the app show warn with the message: aws_iot: Failed to parse JSON: -1 aws_iot: Received JSON is not valid
looking through the code, find that the warining message is send from the file aws_iot_shadow_json.c in the function isJsonValidAndParse() when you try to parse json doc with jsmn.
I printed the json doc received when the warning occurred and the message received was:
{"version":839,"timestamp":1618073884,"state":{"action":"on","config":{"pages":[{"buttons":[{"functionality":0,"color":"gray","brightness":7},{"functionality":0,"color":"red","brightness":7},{"functionality":0,"color":"blue","brightness":7},{"functionality":0,"color":"magenta","brightness":7},{"functionality":0,"color":"lime","brightness":7},{"functionality":0,"color":"yellow","brightness":7},{"functionality":0,"color":"cyan","brightness":7},{"functionality":0,"color":"white","brightness":7}]}]}},"metadata":{"action":{"timestamp":1618071704},"config":{"pages":[{"buttons":[{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}},{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}},{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}},{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}},{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}},{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}},{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}},{"functionality":{"timestamp":1618071721},"color":{"timestamp":1618071721},"brightness":{"timestamp":1618071721}}]}]}},"clientToken":"ThingFab01-0"}
I dont know why the parse json failed? i checked the json and everything looks fine.
Any idea what the problem may be?
Thanks.