如何在PhoneGap中解析此JSON

时间:2014-07-10 13:20:04

标签: javascript json

JSON数据:

  {
      "response": {
      "latitude": {
         "1": "28.5700",
         "2": "28.5700"
      },
      "longitude": {
         "1": "77.329999",
         "2": "77.3200"
      },
      "gps_location_look_up": {
         "1": "1",
         "2": "1"
      }

   }
}

如何解析这个json数据并使用JavaScript 获取这些值(纬度,经度)?如何检索其他键的值?

2 个答案:

答案 0 :(得分:1)

解析json与手机间隙/ cordova无关;纯javascript:Parse JSON in JavaScript?

答案 1 :(得分:0)

JSON.parse('{\
    "response": {\
       "latitude": {\
          "1": "28.5700",\
          "2": "28.5700"\
       },\
       "longitude": {\
          "1": "77.329999",\
          "2": "77.3200"\
       },\
       "gps_location_look_up": {\
          "1": "1",\
          "2": "1"\
       }\
    }\   
}');