有一个简单的 json:
{ "Keys": [
{"Format": "A", "Subtype": "A1"},
{"Format": "A", "Subtype": "A2"},
{"Format": "B", "Subtype": "A1"}]
}
我想使用 JsonPath 表达式(没有 Java 特定实现)生成此结果(格式 + 子类型串联):
AA1
AA2
BA1
是否可以使用 jsonPath 连接字符串元素?
谢谢
最佳答案
以下将给出 AA1
作为结果。
$.concat($.Keys[0].Format,$.Keys[0].Subtype)
同样
$.concat($.Keys[1].Format,$.Keys[1].Subtype) -- AA2
$.concat($.Keys[2].Format,$.Keys[2].Subtype) -- BA1
关于java - 如何使用 JsonPath (JayWay) 连接 json 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45941225/