【发布时间】:2014-07-10 11:50:08
【问题描述】:
我有下面的 json 字符串,我想从这个字符串中提取 "id" 之后的所有 "number":(15124,13498) 字段。
我正在尝试通过 java 代码中的 jsonpath 这样做:
String pd = JsonPath.read(jsonString, "$.response.data.number.id");`
但是由于错误的 jsonpath,我得到了一个异常,我应该写什么 jsonpath 在"number" 字段之后获取"id"?
json 字符串下方:
{
"response": {
"code": 200,
"msg": "Success",
"data": {
"number": {
"id": "13498",
"name": "(Not in used) Daniel - 30138444",
"network_id": 1,
"network_type": "Facebook",
"currency": "USD",
"currency_info": {
"prefix": "$",
"postfix": "",
"name": "US Dollars"
},
"timezone": {
"id": 92,
"code": "PST",
"region": "America",
"locality": "Los_Angeles",
"offset": -7,
"facebook_code": 1
}
}
}
}
}
【问题讨论】:
-
确切的例外是什么?
-
你的问题解决了吗?