Parse the data from json response

[{“schedule_id”:“6194422”,“event_id”:“214941”,“place_id”:“22909”,“start_date”:“20200805”,“event_name”:"\u30ae\u30aa\u30f3\u30b3\u30fc\u30ca\u30fc",“genre_id”:“2”,“subgenre_id”:null,“event_summary”:null,“start_time”:“1800”,“end_time”:“1845”,“flag_d”:“0”,“flag_c”:“0”,“distance”:“0,0”,“place_name”:"\u5f25\u6804\u4f1a\u9928",“latitude”:“35.001743”,“longitude”:“135.775528”},{“schedule_id”:“6021740”,“event_id”:“242445”,“place_id”:“21889”,“start_date”:“20200805”,“event_name”:"\u30e2\u30b9\u30c8\u30ea\u30fc\u30fb\u30e2\u30fc\u30c4\u30a1\u30eb\u30c8\u30fb\u30d5\u30a7\u30b9\u30c6\u30a3\u30d0\u30eb:\u30e2\u30b9\u30c8\u30ea\u30fc\u30fb\u30e2\u30fc\u30c4\u30a1\u30eb\u30c8\u30fb\u30d5\u30a7\u30b9\u30c6\u30a3\u30d0\u30eb\u30fb\u30aa\u30fc\u30b1\u30b9\u30c8\u30e9",“genre_id”:“80”,“subgenre_id”:“379”,“event_summary”:null,“start_time”:“1930”,“end_time”:“2200”,“flag_d”:“0”,“flag_c”:“0”,“distance”:“0,0”,“place_name”:"\u30ea\u30f3\u30ab\u30fc\u30f3\u30fb\u30bb\u30f3\u30bf\u30fc\u3008\u30a8\u30fc\u30f4\u30ea\u30fc\u30fb\u30d5\u30a3\u30c3\u30b7\u30e3\u30fc\u30fb\u30db\u30fc\u30eb\u3009",“latitude”:“40.772671”,“longitude”:"-73.983078"},{“schedule_id”:“6194423”,“event_id”:“214941”,“place_id”:“22909”,“start_date”:“20200805”,“event_name”:"\u30ae\u30aa\u30f3\u30b3\u30fc\u30ca\u30fc",“genre_id”:“2”,“subgenre_id”:null,“event_summary”:null,“start_time”:“1900”,“end_time”:“1945”,“flag_d”:“0”,“flag_c”:“0”,“distance”:“0,0”,“place_name”:"\u5f25\u6804\u4f1a\u9928",“latitude”:“35.001743”,“longitude”:“135.775528”}]

how to parse this Json data ?
I need to get the latitude and longitude from this response.
getproperty of object gives me undefined error.
Please help me how to parse this response and get the data.

Start by pasting the full JSON response into a JSON formatter. That gives you this:

image

The green “response” block in Thunkable contains the full JSON response. When you get an object from the JSON, you can then use the property blocks to find a value. “coord” is a property of the response “object” and “lon” & “lat” are properties of the “coord” object. So this should do the trick:

Replace “lon” with “lat” to get the latitude value.

2 Likes

Moreover to access the properties you should see that the full JSON is encapsulated in an array ( a list ) and the code need to cater for it.

I have copied the response JSON from the post and used it in this simple project to show how you can obtain the data.

https://x.thunkable.com/projectPage/602ba2a49ad9e0001214bbda

Because the JSON response is a list, I used a List Viewer to show the elements in the list. Once you click on any element, the lon/log will show in the two labels,

Hope this helps.

@muneer Thankyou so much for the for working version. It works. but sometimes it shows ’ something went wrong ’ Thanks a lot for your time and help.
@tatiang thankyou so much for the help

1 Like