What you're missing here is that you're doing JSON.parse(data) and not JSON.parse(data.resp)
JSON.parse(data)
JSON.parse(data.resp)
This works great though:
Bangle.http("https://worldtimeapi.org/api/ip").then(data => { let time = JSON.parse(data.resp).datetime.split("T")[1].split(".")[0]; g.clear(); g.drawString("Time: " + time, 120, 120); }).catch(err => { g.clear(); g.drawString("Error: " + err, 120, 120); });
An in the other 7 posts you made about this - it really helps to use the remote debugging for this so you can see what's going on: https://www.espruino.com/Gadgetbridge#remote-debugging
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
What you're missing here is that you're doing
JSON.parse(data)
and notJSON.parse(data.resp)
This works great though:
An in the other 7 posts you made about this - it really helps to use the remote debugging for this so you can see what's going on: https://www.espruino.com/Gadgetbridge#remote-debugging