我需要编写一个 JSONiq 表达式,它只列出成本至少为 3 的产品的名称。这是我在XQuery部分中键入的 JSON 文件:
{ "supermarket_visit":{
"date":"08032019",
"bought":[
"item",{
"type":"confectionary",
"item_name":"Kit_Kat",
"number": 3,
"individual_price": 3.5
},
"item",{
"type":"drinks",
"item_name":"Coca_Cola",
"number": 2,
"individual_price": 3
},
"item",{
"type":"fruits",
"item_name":"apples",
"number": "some"
}
],
"next_visit":[
"item",{
"type":"stationary",
"item_name":"A4_paper",
"number": 1
},
"item",{
"type":"stationary",
"item_name":"pen",
"number": 2
}
]
}
}
这是我的 JSONiq Xquery JSONiq 命令,我真的不知道在哪里输入try.zorba.io:
let $x := find("supermarket_visit")
for $x in $supermarket.bought let $i := $x.item
where $i.individual_price <=3
return $i.item_name
我在 try.zorba.io 中遇到了很多错误,而且我对 JSONiq 和 JSON 真的很陌生。我的 JSON 或 JSONiq 部分有问题吗?