I have a JSON file that contains a sample data
{
  {
  "AL": {
    "type": [
      [
        { "option": "some text" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ],
      [
        { "option": "some text 1" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ],
      [
        { "option": "some text 2" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ],
      [
        { "option": "some text 3" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ]
    ]
  },
  {
  "AK": {
    "type": [
      [
        { "option": "some text 4" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ],
      [
        { "option": "some text 5" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ],
      [
        { "option": "some text 6" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ],
      [
        { "option": "some text 7" },
        { "yes": { "url": "" } },
        { "no": { "url": "" } }
      ]
    ]
  }
}
I get the data using jQuery's getJSON method
var response;
var data = $.getJSON("data/data1.json", function(data) {
    return data;
  });
  data.then(function(res) {
    response = res;
  })
I am trying to construct a variable that maps to the attributes in this Object.
I have tried the like
var key = "response[" + $dropdownKey + "]" + ".type";
and also
var key = "response." + $dropdownKey + ".type";
Where $dropdownKey is set when I select using a <select></select> tag in my HTML.
With this I want to iterate over the Object and get the data;
key.map(function(value) {
  I'd like to get all the options then
})
Because I have many attributes in the Object, I wanted to be able to dynamically tell this map function that the location of the attributes change based on user selection.
What am I doing wrong here?
 
    