从下面的json数据我怎样才能获得address: '172.16.2.18'
我只想从以下josn数据中获取172.16.2.18
。如何可能?
{
'Local Area Connection': [{
address: 'fe80::c1c6:e78a:ece:435',
family: 'IPv6',
internal: false
}, {
address: '172.16.2.18',
family: 'IPv4',
internal: false
}],
'VMware Network Adapter VMnet1': [{
address: 'fe80::55d6:5243:74eb:ec58',
family: 'IPv6',
internal: false
}, {
address: '169.254.236.88',
family: 'IPv4',
internal: false
}
'VMware Network Adapter VMnet8': [{
address: 'fe80::a50c:fc9f:921a:7a22',
family: 'IPv6',
internal: false
}, {
address: '169.254.122.34',
family: 'IPv4',
internal: false
}
'Loopback Pseudo-Interface 1': [{
address: '::1',
family: 'IPv6',
internal: true
}, {
address: '127.0.0.1',
family: 'IPv4',
internal: true
}]
}
答案 0 :(得分:0)
您的json数据中有几个语法错误*,但一旦纠正,您可以使用以下命令访问该元素:
var address = jsonData["Local Area Connection"][1].address;
*在每个“适配器列表”
之后,语法错误缺少关闭数组和逗号(],
)