title: Convert JSON Object to a simple array
body: <p>I have the following nested JSON Object coming from this call:</p>
  
  <pre><code>var jsonData = jQuery.ajax({
              url: "http://testsite/_vti_bin/listdata.svc/ProjectHours",
              dataType: "json",
              async: false
          }).responseText;
  </code></pre>
  
  <hr>
  
  <pre><code>{
      "d": {
          "results": [
              {
                  "__metadata": {
                      "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(1)",
                      "etag": "W/\"1\"",
                      "type": "Microsoft.SharePoint.DataService.ProjectHoursItem"
                  },
                  "ContentTypeID": "0x0100C5D130A92A732D4C9E8489B50657505B",
                  "Title": "Ryan Cruz",
                  "Hours": 35,
                  "Id": 1,
                  "ContentType": "Item",
                  "Modified": "/Date(1373535682000)/",
                  "Created": "/Date(1373535682000)/",
                  "CreatedBy": {
                      "__deferred": {
                          "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(1)/CreatedBy"
                      }
                  },
                  "CreatedById": 19,
                  "ModifiedBy": {
                      "__deferred": {
                          "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(1)/ModifiedBy"
                      }
                  },
                  "ModifiedById": 19,
                  "Owshiddenversion": 1,
                  "Version": "1.0",
                  "Attachments": {
                      "__deferred": {
                          "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(1)/Attachments"
                      }
                  },
                  "Path": "/sites/itg/Resourcecenters/spwidgets/Lists/ProjectHours"
              },
              {
                  "__metadata": {
                      "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(2)",
                      "etag": "W/\"1\"",
                      "type": "Microsoft.SharePoint.DataService.ProjectHoursItem"
                  },
                  "ContentTypeID": "0x0100C5D130A92A732D4C9E8489B50657505B",
                  "Title": "Phillip Phillips",
                  "Hours": 25,
                  "Id": 2,
                  "ContentType": "Item",
                  "Modified": "/Date(1373535694000)/",
                  "Created": "/Date(1373535694000)/",
                  "CreatedBy": {
                      "__deferred": {
                          "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(2)/CreatedBy"
                      }
                  },
                  "CreatedById": 19,
                  "ModifiedBy": {
                      "__deferred": {
                          "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(2)/ModifiedBy"
                      }
                  },
                  "ModifiedById": 19,
                  "Owshiddenversion": 1,
                  "Version": "1.0",
                  "Attachments": {
                      "__deferred": {
                          "uri": "http://testsite/_vti_bin/listdata.svc/ProjectHours(2)/Attachments"
                      }
                  },
                  "Path": "/sites/itg/Resourcecenters/spwidgets/Lists/ProjectHours"
              }
          ]
      }
  }
  </code></pre>
  
  <p>I want to  loop through each object's Title and Hours attribute and save them in an array so I can pass it to the google chart as below:</p>
  
  <pre><code>var data = google.visualization.arrayToDataTable(array);
  </code></pre>
  
  <p>I tried the following code, but it can't find the json object:</p>
  
  <pre><code>function drawTable() {
      var jsonData = jQuery.ajax({
                  url: "http://testsite/_vti_bin/listdata.svc/ProjectHours",
                  dataType: "json",
                  async: false
              }).responseText;
  
              alert(jsonData);
              var obj = jQuery.parseJSON(jsonData);
              //alert(jsonData.length);
              var sampleData = [], results = d.results;
              for (var i = 0, len = results.length; i &lt; len; i++) {
                  var result = results[i];
                  sampleData.push({ Title: result.Title, Hours: result.Hours});
              }
  
              var data = google.visualization.arrayToDataTable(obj);
              var chart = new google.visualization.PieChart(document.getElementById('spChart')); 
              chart.draw(data, {showRowNumber: true}); 
  }
  </code></pre>
  
  <p>Please give me some ideas so i don't get stuck here for the rest of the day. Thank you!</p>