Read JSON data returned by google maps

旧城冷巷雨未停 提交于 2019-12-11 01:02:16

问题


In my app I use the BlackBerry API to get latitude and longitude. I would like to do reverse geocoding using Google maps by creating an http connection. How do I parse the data, and then read a specific element, such as the address?

An example URL:

http://maps.google.com/maps/geo?json&ll=9.6,73.7

Gives response:

{
  "name": "9.600000,76.760000",
  "Status": {
    "code": 200,
    "request": "geocode"
  },
  "Placemark": [ {
    "id": "p1",
    "address": "Kanjirappalli Elikkulam Rd, Kerala, India",
    "AddressDetails": {
   "Accuracy" : 6,
   "Country" : {
      "AdministrativeArea" : {
         "AdministrativeAreaName" : "Kerala",
         "SubAdministrativeArea" : {
            "SubAdministrativeAreaName" : "Kottayam",
            "Thoroughfare" : {
               "ThoroughfareName" : "Kanjirappalli Elikkulam Rd"
            }
         }
      },
      "CountryName" : "India",
      "CountryNameCode" : "IN"
   }

回答1:


Use the JSON ME library. See Using JSON in Java ME for examples of how to use it.



来源:https://stackoverflow.com/questions/4967033/read-json-data-returned-by-google-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!