Json Path Expression将数组转换为字符串

时间:2017-03-31 13:32:51

标签: java json jsonpath jpath

我试图找到一种方法将json数组转换为json字符串。

http://jsonpath.com/

JSON

{
  "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"
    }
  ]
}

输出 iphone

表达式我试过,

$.phoneNumbers[:1].type[,]
$.phoneNumbers[:1].type
$.phoneNumbers[:1].type

提前致谢

0 个答案:

没有答案