I am trying to get travel distance by car using bing maps api between 2 addresses.
So far I have got the link which returns a JSON file with data but unsure how to get;set; the results to a basic class variable.
Link : var url = "http://dev.virtualearth.net/REST/V1/Routes/Driving?wp.0=11+streetname+parish+city+Postcode&wp.1=3+DestinationStreet+DestinationParish+DestinationPostcode&optimizeWaypoints=true&distanceUnit=mi&key= MY BING API KEY
This returns the following JSON (only part of it):
{
"authenticationResultCode": "ValidCredentials",
"brandLogoUri": "http://dev.virtualearth.net/Branding/logo_powered_by.png",
"copyright": "Copyright © 2018 Microsoft and its suppliers. All rights
reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
"resourceSets": [
{
"estimatedTotal": 1,
"resources": [
{
"__type": "Route:http://schemas.microsoft.com/search/local/ws/rest/v1",
"bbox": [
53.4669,
-1.24426,
53.48046,
-1.19207
],
"id": "v69,h-704643067,i0,a0,cen-US,dAAAAAAAAAAA1,y0,s1,m1,o1,t4,wsyPVd369SkDytPzAVR7zvw2~AxDMnWdxYwgCAADgAS8AJj8A0~MzMgQmFpbmVzIEF2ZW51ZSwgRG9uY2FzdGVyLCBETjEyIDFQUSwgVW5pdGVkIEtpbmdkb201~~~~v11,w1xcJbTm9SkCMg0vHnOfzvw2~AxDMnWdhYwYCAADgAcWQTz4A0~MyBMaWxhYyBHcm92ZSwgRG9uY2FzdGVyLCBETjEyIDJKTCwgVW5pdGVkIEtpbmdkb201~~~~v11,k0",
"distanceUnit": "Mile",
"durationUnit": "Second",
"routeLegs": [
{
"actualEnd": {
"type": "Point",
"coordinates": [
53.478315,
-1.244046
]
},
"actualStart": {
"type": "Point",
"coordinates": [
53.480423,
-1.194906
]
},
"alternateVias": [],
"cost": 0,
"description": "B6376, B6094",
"endLocation": {
"bbox": [
53.477323,
-1.245981,
53.479571,
-1.242203
],
"name": "Address of first way point",
"point": {
"type": "Point",
"coordinates": [
53.478447,
-1.244092
]
},
How can I read this file / set in a class the data such as longitude/latitude and address etc?