放心的GPATH表达方式是什么
我试图使用过滤条件创建GPATH表达式,以返回“ mynotes”
在'“ my-type”'''
'''data.my-node.nodes时。 findall {it.'my-type'=='常规'}。'my-nodes'''''
但无法从下面的json获得响应
{
"data": {"my-node": [
{
"nodes": [ {
"my-nodes": [{"my-note": "abcdefg"}],
"my-type": "GENERAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "abcdefg"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "oiugitoirtuhou"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "ifuoirjhihj"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "idfgdiufgdhsfuihdf"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "iydfgsigdfgdgidsf"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
}
]}
}
I have tried to create GPath expression with filter criteria to return "my-notes"
in list of object when '"my-type"' is SPECIAL
like : '"data.my-node.nodes.findAll{it.'my-type'=='GENERAL'}.'my-nodes'"'
but unable to get response from the below json
{
"data": {"my-node": [
{
"nodes": [ {
"my-nodes": [{"my-note": "abcdefg"}],
"my-type": "GENERAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "abcdefg"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "oiugitoirtuhou"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "ifuoirjhihj"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "idfgdiufgdhsfuihdf"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
},
{
"nodes": [ {
"my-nodes": [{"my-note": "iydfgsigdfgdgidsf"}],
"my-type": "SPECIAL"
}],
"my-instruction": null
}
]}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GPATH语法是
['key-abc']
对键包含特殊字符。flatten()
方法将2D数组制成1D数组。The GPath syntax is
['key-abc']
for keys contain special characters.flatten()
method to make 2D array to 1D array.