-3

JSON data :

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

   }
}

How can one parse this json data and get these values (latitude,longitude) using JavaScript? How can one retrieve value of other keys?

Dawson Loudon
  • 6,029
  • 2
  • 27
  • 31
user3227686
  • 21
  • 1
  • 6

2 Answers2

1

Parsing json has nothing to do with phone gap/cordova; its pure javascript: Parse JSON in JavaScript?

Community
  • 1
  • 1
Scott Hunter
  • 48,888
  • 12
  • 60
  • 101
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"\
       }\
    }\   
}');
Andreas Furster
  • 1,558
  • 1
  • 12
  • 28
  • This is actually incorrect. You have to pass `.parse()` a string, not an object. Should be `JSON.parse('{...}');` and also be 1 line then because string literals can't span lines in JavaScript. – CodingWithSpike Jul 10 '14 at 13:31