I have the following nested JSON Object coming from this call:
var jsonData = jQuery.ajax({
            url: "http://testsite/_vti_bin/listdata.svc/ProjectHours",
            dataType: "json",
            async: false
        }).responseText;
{
    "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"
            }
        ]
    }
}
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:
var data = google.visualization.arrayToDataTable(array);
I tried the following code, but it can't find the json object:
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 < 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}); 
}
Please give me some ideas so i don't get stuck here for the rest of the day. Thank you!
 
    