I have the following json:
{
"result":[
{
"a": 500000,
"b": null,
"c": 0,
"d": 0,
"e": 1855
},
{
"a": 500001,
"b": null,
"c": 0,
"d": 0,
"e": 3770
}
],
"host": "43252ed565f9",
"time": "Wed Mar 23 09:57:43 UTC 2016",
"status": "Ok"
}
I'm trying to parse it, but got a strange value of "["
, instead each one of the keys.
function f() {
var request1 = $.ajax({
url: '/a',
type: 'GET',
});
var request2 = $.ajax({
url : '/b',
type: "GET"
});
$.when(request1, request2).done(function(result1, result2){
//result1 = [Object, "success", Object]
json = JSON.stringify(result1)
for( key in json){
myJson = json[key] //The value is: "["
a = myJson['a']
b = myJson['b']
c = myJson['c']
d = myJson['d']
e = myJson['e']
}
})
}
What could be the issue?