JSON Path使用说明
表达式说明
目前JSONPath仅支持链装调用
$
表示文档的根元素.nodeName
或[nodeName]
表示匹配下级节点
示例
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}
表达式:$.firstName 值:"John"
表达式:$.age 值:26
表达式:$.phoneNumbers[:1].type 值:"iPhone"