title: JavaScript: Parse JSON with dynamic key values
body: <p>I have a JSON as below and I want to extract data from columns and rows array from it. </p>
  
  <pre><code>{
    "id":0,
    "tabName":"newtab",
    "columns":[
      {
        "id":0,
        "name":"firstname",
        "type":"entity",
        "operator":"=",
        "$$hashKey":"object:40"
      },
      {
        "id":1,
        "name":"address",
        "type":"domain",
        "operator":"&lt;",
        "$$hashKey":"object:50"
      }
    ],
  "rows":[
    {
      "0":"Adam", //this first row data corresponds to "Name" column
      "1":"5432 River Drive", //this first row data corresponds to "Address" column
      "$$hashKey":"object:34",
      "tabId":"1122", 
      "description":"New Tab",
      "id":1
    },
    {
      "0":"Silver",  //this 2nd row data corresponds to "Name" column
      "1":"Address 2", //this 2nd row data corresponds to "Address" column
      "$$hashKey":"object:53",
      "tabId":"2345",
      "description":"New 2nd Tab",
      "id":2
    }
  ],
  "uniqueIdCounter":3
  }
  </code></pre>
  
  <p>From the above JSON, I want to extract columns and rows values. This is just sample JSON and the actual one can have more column and rows entries.</p>
  
  <p>In the columns array:
  id, name, type operator keys remain the same for every column entry.</p>
  
  <p>In the rows array:
  tabid, description and id keys remain the same for every row entry.</p>
  
  <p>The issue with the row array is the key values "0", "1" (that actually correspond to columns firstname &amp; address). How to loop through this array and extract these dynamic values? By dynamic I mean if I have more than 2 rows, the keys in the rows would be "0", "1", "2" and so on for other rows.</p>
  
  <p>I started with writing this loop:</p>
  
  <pre><code>var jsonColumns = JSON.parse(JSON.stringify($scope.myTable.columns));
  for (var i = 0; i &lt; jsonColumns.length; i++) {
      var obj = jsonColumns[i]; 
      //For columns data I can do obj.id, obj.name etc and works fine
  }
  </code></pre>
  
  <p>For rows I am not sure how to proceed here:</p>
  
  <pre><code>var jsonRows = JSON.parse(JSON.stringify($scope.myTable.rows));
  for (var i = 0; i &lt; jsonRows.length; i++) {
      var obj = jsonRows[i]; 
      //How can I extract rows with keys "0", "1" where I dont know these key names in advance
  }
  </code></pre>
  
  <p>Any inputs to this, please? Thanks</p>