Evening Livecoders
I wonder if anyone could help me with the following:-
I've previously had some success importing the json response from something and then extracting the info I wanted. However, this time, to many hours has got me nowhere, so here I am again.
The request is a variation on this- https://maps.googleapis.com/maps/api/di ... dVjYr8a9Ew
All I want to do extract the distance values for each location i.e. 24m / 0.7km, but apart from the addresses everything comes back blank.
It seems to be laid out differently to last time? before so I think I must be using the wrong keys or something.
As ever any help much appreciated.
Kind regards
Paul
parsing json
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: parsing json
Hi Paul,
you could load the url and then convert it to an LC array with:
Then you can parse that array.
Hint:
To visualize the content of an array you can use a treeview-widget and set its "arraydata" to any array:
Great for understanding arrays, seeing is believing!
Best
Klaus
you could load the url and then convert it to an LC array with:
Code: Select all
...
put url("https://maps.googleapis.com/maps/api/distancematrix/json?origins=50.868376,0.251201...9Ew") into tMap
put jsontoarray(tMap) into tLCArray
...
Hint:
To visualize the content of an array you can use a treeview-widget and set its "arraydata" to any array:
Code: Select all
...
put url("https://maps.googleapis.com/maps/api/distancematrix/json?origins=50.868376,0.251201...9Ew") into tMap
put jsontoarray(tMap) into tLCArray
set the arraydata of widget "you tree view widget here" to tLCArray
...
Best
Klaus
-
- Posts: 58
- Joined: Sat Jun 15, 2019 10:09 am
Re: parsing json
Hi Klaus
What can I say - perfect! thank you; 5 hours to 5 minutes.
Kind regards
Paul
What can I say - perfect! thank you; 5 hours to 5 minutes.
Kind regards
Paul