Google Geocoding Json Parsing Issue in C#

前端 未结 2 1757
孤街浪徒
孤街浪徒 2020-12-18 14:37

I have my code working fine, but I can\'t seem to be able to get to the deeper parts of the tree. I\'m trying to pull the longitude and the latitude. The code below pulls \'

2条回答
  •  粉色の甜心
    2020-12-18 15:22

    The syntax for 'geometry' -> 'location' -> 'lat' and 'lng' is:

    JObject data = JObject.Parse(result);
    
    string lat = (string)data["results"][0]["geometry"]["location"]["lat"];
    string lng = (string)data["results"][0]["geometry"]["location"]["lng"];
    

提交回复
热议问题