Hi.
I fixed a few errors in your project and it seems to process the JSON correctly.
None of the errors i fixed were related to your JSON processing however, your HttpClients needed to be declared as Process objects not Global objects.
And they both needed to be Initialized before using them.
After Initializing the HttpClients i updated your HttpClient callbacks Sub names with the EventName i used to Initialize them.
Then i included the StringUtils library and UrlEncoded the 'From' and 'Destination' values.
The result - still an error.
So i updated your JSON parsing routine to check the 'status' property of the directions, here's the response from Google:
{
"routes" : [],
"status" : "REQUEST_DENIED"
}
Your JSON parsing wasn't failing but Google are refusing to process your request!
I sent the same request on my desktop computer and saved the result - the request was properly process and status was ok.
I moved the saved result file to your project assets and changed the line that loaded the ResponseString:
ResponseString=File.ReadString(File.DirAssets, "Directions2.json")
Zooming out the map i can now see your code has properly parsed the JSON and rendered a path, no tiles are loaded as you've disbaled data connection.
(I actually renabled data but still no tiles loaded - don't have time to look into that right now).
The problem is the
sensor parameter in your request, it should be
true or
false but NOT
True!!
https://developers.google.com/maps/documentation/directions/
request.InitializeGet("http://maps.googleapis.com/maps/api/directions/json?origin="& From &"&destination="& Destination &"&sensor=false")
Now it all works!
I've attached London.B4A so you can see my edits.
Martin.