[
{
"status_code":"200",
"status_message":"Success!",
"new_data":[
{
"User1":{
"info":[
{
"id":"1",
"name":"ABC"
},
{
"id":"2",
"name":"XYZ"
}
]
},
"User2":{
"info":[
{
"id":"1",
"name":"bcd"
},
{
"id":"2",
"name":"bcdx"
}
]
}
}
]
}
]
Выше мой json-ответ от моего сервера.Я хочу получить значение ключа массива.Я делаю так:
var obj = JSON.parse(responseData); // ABOVE GIVEN JSON RESPONSE
obj[0].new_data.map((item, key) => {
console.log(item)
console.log(key)
})
console.log(item) returns array of User1 & User2
Я хочу напечатать User1 & User2, а затем углубиться, чтобы получить значения User1 и User2.Я пытался использовать console.log(item.key)
, но не работает