bblanchon / ArduinoJson

📟 JSON library for Arduino and embedded C++. Simple and efficient.
https://arduinojson.org
MIT License
6.69k stars 1.12k forks source link

Object Failed - please help #830

Closed njordan77 closed 5 years ago

njordan77 commented 5 years ago

Hi, i read the ObjectFailed-FAQ and tried all the suggestions, but nothing solved my issue. once your library worked perfect with the publictransport-API JSON link, but since a year it simply does not. Can you please give me a helping hand as right now i'm clueless. Also tried nesting increased....no success.... Thanks Norbert

{"data":{"monitors":[{"locationStop":{"type":"Feature","geometry":{"type":"Point","coordinates":[16.3699634898987,48.2362452209474]},"properties":{"name":"60201667","title":"Jägerstraße","municipality":"Wien","municipalityId":90001,"type":"stop","coordName":"WGS84","attributes":{"rbl":2167}}},"lines":[{"name":"31","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":true,"realtimeSupported":true,"trafficjam":false,"departures":{"departure":[{"departureTime":{"timePlanned":"2018-10-17T11:26:00.000+0200","timeReal":"2018-10-17T11:26:43.000+0200","countdown":0}},{"departureTime":{"timePlanned":"2018-10-17T11:32:00.000+0200","timeReal":"2018-10-17T11:33:54.000+0200","countdown":7}},{"departureTime":{"timePlanned":"2018-10-17T11:38:00.000+0200","timeReal":"2018-10-17T11:35:59.000+0200","countdown":9},"vehicle":{"name":"31","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":false,"realtimeSupported":true,"trafficjam":false,"type":"ptTram","attributes":{},"linienId":131}},{"departureTime":{"timePlanned":"2018-10-17T11:44:00.000+0200","timeReal":"2018-10-17T11:44:00.000+0200","countdown":17}},{"departureTime":{"timePlanned":"2018-10-17T11:50:00.000+0200","timeReal":"2018-10-17T11:50:00.000+0200","countdown":23}},{"departureTime":{"timePlanned":"2018-10-17T11:56:00.000+0200","timeReal":"2018-10-17T11:56:00.000+0200","countdown":29}},{"departureTime":{"timePlanned":"2018-10-17T12:02:00.000+0200","timeReal":"2018-10-17T12:02:00.000+0200","countdown":35}},{"departureTime":{"timePlanned":"2018-10-17T12:08:00.000+0200","timeReal":"2018-10-17T12:08:00.000+0200","countdown":41},"vehicle":{"name":"31","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":false,"realtimeSupported":true,"trafficjam":false,"type":"ptTram","attributes":{},"linienId":131}},{"departureTime":{"timePlanned":"2018-10-17T12:14:00.000+0200","timeReal":"2018-10-17T12:14:00.000+0200","countdown":47},"vehicle":{"name":"31","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":false,"realtimeSupported":true,"trafficjam":false,"type":"ptTram","attributes":{},"linienId":131}},{"departureTime":{"timePlanned":"2018-10-17T12:20:00.000+0200","timeReal":"2018-10-17T12:20:00.000+0200","countdown":53}},{"departureTime":{"timePlanned":"2018-10-17T12:21:00.000+0200","countdown":54},"vehicle":{"name":"31","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":false,"realtimeSupported":true,"trafficjam":false,"type":"ptTram","attributes":{}}},{"departureTime":{"timePlanned":"2018-10-17T12:27:00.000+0200","countdown":60},"vehicle":{"name":"31","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":false,"realtimeSupported":true,"trafficjam":false,"type":"ptTram","attributes":{}}},{"departureTime":{"timePlanned":"2018-10-17T12:33:00.000+0200","countdown":66},"vehicle":{"name":"31","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":false,"realtimeSupported":true,"trafficjam":false,"type":"ptTram","attributes":{}}}]},"type":"ptTram","lineId":131}]},{"locationStop":{"type":"Feature","geometry":{"type":"Point","coordinates":[16.3699634898987,48.2362452209474]},"properties":{"name":"60201667","title":"Jägerstraße","municipality":"Wien","municipalityId":90001,"type":"stop","coordName":"WGS84","attributes":{"rbl":2167}}},"lines":[{"name":"30","towards":"Stammersdorf","direction":"H","richtungsId":"1","barrierFree":false,"realtimeSupported":true,"trafficjam":false,"departures":{"departure":[{"departureTime":{"timePlanned":"2018-10-17T11:37:00.000+0200","countdown":10}},{"departureTime":{"timePlanned":"2018-10-17T11:49:00.000+0200","countdown":22}},{"departureTime":{"timePlanned":"2018-10-17T12:01:00.000+0200","countdown":34}}]},"type":"ptTram","lineId":130}]}]},"message":{"value":"OK","messageCode":1,"serverTime":"2018-10-17T11:26:22.426+0200"}}

bblanchon commented 5 years ago

Hi Norbert,

I'll be glad to help you, but there is not much I can do with so little information. What microcontroller are you using? What did you try to troubleshoot? It worked before; what changed since then?

Since the document is quite big, it's very likely that it's a memory issue.

BTW, you are right to raise the nesting limit; the assistant raises it to 11.

To prove that there is nothing wrong with the parser, here is an online demo: https://wandbox.org/permlink/IBE7I2U0ufD03IxO

However, I saw that the ArduinoJson Assistant suggested a too small bufferSize. So I recommend that you increase the size to make sure that the DynamicJsonBuffer only makes one allocation.

I know you've read the FAQ, but to be sure we're talking about the same page, here is the link again:

Regards, Benoit