SharePoint 2013 RestAPI retrieve Task and subtask Parent id undefined

I am trying to retrieve the sub-task of the parent task from a list. query:

../_api/web/lists/getbytitle(‘Tasks’)/items?$ select=Title,Status,ParentID/Id&$ expand=ParentID

Code:

function onQuerySucceeded(data) {     var mainTasks = [];     var subTasks = [];     for (var i = 0; i < data.length; i++) {         if (data[i].ParentID.Id) {             subTasks.push(data[i]);         } else {             mainTasks.push(data[i]);         }      }     $  .each(data.d.results, function (key, value) {         subTasks += '<strong>Title: </strong> ' + value.Title +             ' <strong>Status:</strong> ' + value.Status + ' <strong>Parent Id:</strong> ' + value.Id +             '<br />';     });      $  ("#divSubTaskItems").html(subTasks);  }; 

My results are:

undefined: “Title: Test rest Call Status: In Progress Parent Id: undefined”