{
"key" : "value",
"array.fruits" : [
{ "key" : 1 },
{ "key" : 2, "dictionary": {
"a": "Apple",
"b": "Butterfly",
"c": "Cat",
"d": "Dog"
} },
{ "key" : 3 }
]
}
如何在json查询中解析键“ array.fruits”。
答案 0 :(得分:1)
您可以使用bracket notation property accessor来获得所需的值:
const data = {
"key" : "value",
"array.fruits" : [
{ "key" : 1 },
{ "key" : 2, "dictionary": {
"a": "Apple",
"b": "Butterfly",
"c": "Cat",
"d": "Dog"
} },
{ "key" : 3 }
]
}
console.dir(data["array.fruits"])