[英]Jsonata filter value by looking at parent element
I've a JSON blob in the following form:我有以下形式的 JSON blob:
{
"allEntries": [
{
"property": {
"type": "ab"
}, "values": {
"score": 10.40
}
},
{
"property": {
"type": "ty"
}, "values": {
"score": 90.45
}
}
]
}
I want to just check if the score of property type ab
is less than 10. However $min(allEntries.values.score)
goes through all the properties and does not filter out types which I'm not interested in. I tried using the parent property '%.'我只想检查属性类型
ab
的分数是否小于 10。但是$min(allEntries.values.score)
遍历所有属性并且不会过滤掉我不感兴趣的类型。我尝试使用父属性 '%.' however that doesn't work either ( The object representing the 'parent' cannot be derived from this expression
)但是这也不起作用(
The object representing the 'parent' cannot be derived from this expression
)
You haven't said what the desired output is, but you can filter the list of array entries using the following expression:您尚未说明所需的输出是什么,但您可以使用以下表达式过滤数组条目列表:
allEntries[property.type='ab' and values.score < 10]
See https://try.jsonata.org/BzJKGrIIG见https://try.jsonata.org/BzJKGrIIG
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.