所以我编写了一个 JSON 文件代码来帮助显示书籍的标题,但是当我编译时,我一直收到同样的错误,有没有办法修复或者我做错了什么?
代码如下:
jsoniq version "1.0";
let $file: = {
{
"title": "Fifty Shades of Grey",
"author": "E.L.",
"date_read": {
"month": "May",
"year": "2016"
},
"opinion": "Did not like very much"
},
{
"title": "The grass is singing",
"author": "Doris Lessing",
"date_read": {
"month": "June",
"year": "2016"
},
"opinion": "Enjoyed quite a bit"
},
{
"title": "A short history on nearly everything",
"author": "Bill Bryson",
"date_read": {
"month": "July",
"year": "2016"
},
"opinion": "Very informative"
},
{
"title": "JSON in 24 hours",
"author": "Peter Settler",
"purpose": "Work"
},
{}
}
for $x in $file
return $x.title
已显示的错误:
Error: Parse error on line 1:
jsoniq version "1.0"
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'