【发布时间】:2021-05-21 12:48:47
【问题描述】:
我遍历一个 JSON,我想找出特定键的路径。
例如我有 JSON:
`{"address": {
"city": {
"type": "string"
},
"country": {
"type": "string"
},
"county": {
"type": "string"
},
"street": {
"car"{
"type": "string"
}
"type": "string"
}
}`
我想获取关键汽车的路径以将其引用到其他地方。
【问题讨论】:
-
密钥
type的路径是什么?您是在寻找第一次、最后一次还是所有发生的事件? -
钥匙车的路径,不是类型的。
-
密钥
car的路径是address.street.car。 -
是的,但我想了解如何通过 javascript 函数动态获取它
标签: javascript arrays json typescript