So I have written a JSON file code to be able to help display the title of books but when I compile I kept getting this same error, is there a way for the fix or am I doing something wrong?
The code is below:
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 that has been displayed:
Error: Parse error on line 1:
jsoniq version "1.0"
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'