When I try to parse json in google appscript using the following code, I was expecting dataAll as an object but the debugger shows dataAll as string and because of this reason, I couldn't parse the json.
var response = UrlFetchApp.fetch(aUrl, getUrlFetchOptions());
var resposnsestring = response.getContentText();
var dataAll = JSON.parse(response.getContentText());
Here is the data/
{
"DataSet" : [ {
"Record" : [ {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000GcJUfAAN"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000GcJUfAAN"
}, {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000GcJUDAA3"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000GcJUDAA3"
}, {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000GcJUEAA3"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000GcJUEAA3"
}, {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000Lpbl0AAB"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000Lpbl0AAB"
}, {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000Lpbl1AAB"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000Lpbl1AAB"
}, {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000Lpbl2AAB"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000Lpbl2AAB"
}, {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000Lpbl3AAB"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000Lpbl3AAB"
}, {
"attributes" : {
"type" : "Opportunity",
"url" : "/services/data/v31.0/sobjects/Opportunity/006i000000A89SCAAZ"
},
"Name" : "EM- Deadul Technology",
"Amount" : 100.00,
"AccountId" : "001i000000Q9c8vAAB",
"Account" : {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Id" : "001i000000Q9c8vAAB"
},
"Id" : "006i000000A89SCAAZ"
} ],
"ObjectName" : "Opportunity",
"DataSetName" : "opp"
}, {
"Record" : [ {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v31.0/sobjects/Account/001i000000Q9c8vAAB"
},
"Name" : "Ellie Mae",
"Phone" : "(671) 214-5678",
"Fax" : "(671) 214-5600",
"Id" : "001i000000Q9c8vAAB"
} ],
"ObjectName" : "Account",
"DataSetName" : "acc"
} ]
}