Trying to parse:
[{"place_id":84979036,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","powered_by":"Map Maker: https://maps.co","osm_type":"node","osm_id":8358755414,"boundingbox":["35.8497801","35.8897801","-114.6800654","-114.6400654"],"lat":"35.8697801","lon":"-114.6600654","display_name":"Willow Beach, Mohave County, Arizona, United States","class":"place","type":"village","importance":0.47500000000000003}]
But the boundingbox:[] in the statement are causing errors, I can't get rid of them so I need to find a way to pull the lat and lon without getting this error.
Error:
Newtonsoft.Json.JsonReaderException: 'Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.'
Code:
bool PullGeoJson(string city, string state, out string[] output)
{
HttpResponse<string> response = UnirestLocationRequest(city, state);
Console.WriteLine(response.Body.ToString());
JObject json = JObject.Parse(response.Body.ToString());
output = new string[2];
output[0] = json.GetValue("lat").ToString();
output[1] = json.GetValue("lon").ToString();
return !(output == null);
}