0

This is the json response which i receive (consider that it is in a proper json format) for json in proper format pls see here https://jsonblob.com/57c6d993e4b0dc55a4f1fcd6

i am using an ajax call to get the response, i want to get the id and product

i can get the value when i use something like this

alert(response.issue.backingMap.india.camera[0].product); 

and it is printing properly as "ghee" but in my case, india and camera are actually stored in a variable consider it to be country and type respectively eg var country = india and var type=camera.

alert(response.issue.backingMap.country.type[0].product); is not working. how can i use a variable here

Sagar R
  • 595
  • 3
  • 14
Pradheep
  • 139
  • 11

1 Answers1

1

you should use the following format than

response.issue.backingMap[country][type][0].product

where country and type are variables with the right value.

sagie
  • 1,744
  • 14
  • 15