[Resolved] JSON.parse issue #6336
Replies: 1 comment
-
Posted at 2019-12-15 by @allObjects Can you please post the JSON in its entirety? Posted at 2019-12-15 by user106712 This is JSON as parsed by node.js on a desktop:
The actual text string comes from https://worldtimeapi.org/api/timezone/America/New_York Posted at 2019-12-15 by maze1980
Posted at 2019-12-15 by @allObjects If you know the protocol between JSON strings - such as cr/lf, cr, lf, you can write something like is done for GPS where the (non-JSON) sentences come in line by line. With every new arrival of a data fragment you look for the separation (ends and begins) and process when one found... see GPS module source at https://www.espruino.com/modules/GPS.js Posted at 2019-12-15 by @MaBecker Check this snippet to set the time: http://forum.espruino.com/conversations/280894/#12755183 Find more at the "Tips and Tricks" page Posted at 2019-12-16 by @gfwilliams Just to add the fix for what you want is just the second example here: https://www.espruino.com/Internet#client
basically get all the data, then parse in one go when the socket is closed Posted at 2019-12-16 by user106712 Thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-12-15 by user106712
I use the following code on a desktop computer as well as on an ESP8266 (2v04).
node.js on the desktop could parse the output just fine :
ESP8266 shows the following:
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions