Skip to content
Advertisement

How to get parameter values out of json post

I am trying to use the bing maps api to get travel time and distance between 2 gps coordinates. I get a json answer, however, I am not able to get the values out of this dictionary ?

JavaScript

gives the following result:

JavaScript

now: how do I get the travelDistance out of this ? (14.511 in this case) or the travelDuration ? (21.9667)

tried to get the key and value pairs, but not really getting further with this.

with some other code, I got the keys :

authenticationResultCode brandLogoUri copyright resourceSets statusCode statusDescription traceId

Advertisement

Answer

You could also use json.loads() and pass the content of your response. Then access values like you do from a dictionary:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement