我一直在寻找几个没有运气的时间,虽然我确信它是简单而明显的。我将以下JSON对象作为字符串从API调用中接收,然后使用JSON.parse创建对象。我可以使用标准符号,如obj.Header.Statuscode或obj.Body来访问数据。但是,无论我尝试什么,我都无法访问LIPIdList对象。我认为它应该可以通过obj.Body.LIPIdList访问,但我得到一个未定义的错误。请有人向我解释我在这里缺少什么?非常感谢!
{ "CommuniqueType": "ReadResponse",
"Header": {
"MessageBodyType": "OneLIPIdListDefinition",
"StatusCode": "200 OK",
"Url": "/server/2/id" },
"Body": {
"LIPIdList": {
"Devices": [
{
"Name": "Smart Bridge",
"ID": 1,
"Buttons": [
{
"Name": "Test",
"Number": 1
},
]
},
{
"Name": "Pico Test",
"ID": 3,
"Buttons": [
{
"Number": 2
},
{
"Number": 3
},
{
"Number": 4
},
{
"Number": 5
},
{
"Number": 6
}
]
}
],
"Zones": [
{
"Name": "Office",
"ID": 2
}
]
}}}