Hi I am working on calculating distance from one location to another. I got the JSON format from the response but further I am not able to get the distance from JSON in my apex code. I have also taken help from this link Distance calculation API but I got the error Error message: Invalid decimal:
. I am getting the response in the below format
{
"destination_addresses" : [ "New York, NY, USA" ],
"origin_addresses" : [ "Washington, DC, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "225 mi",
"value" : 361993
},
"duration" : {
"text" : "3 hours 52 mins",
"value" : 13943
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
Can anyone tell me please how can I get the value of distance: 225 mi
I have also looked JSON2Apex
but did not understand how would I use that.