Closed scotttrinh closed 2 weeks ago
Creating a JSON literal with e.json wraps your string in $$ to handle multiline strings, as noted in the docs:
e.json
$$
select $$one two three$$; # multiline raw string
Here's an example of a failing query:
const data = [{ title: "Black Widow $$$*", genre: "Action", rating: 5 }]; const q2 = e.for(e.json_array_unpack(e.json(data)), (j) => e.insert(e.Movie, { title: e.cast(e.str, e.json_get(j, "title")), genre: e.cast(e.Genre, e.json_get(j, "genre")), rating: e.cast(e.int16, e.json_get(j, "rating")), }), );
Generates:
FOR __forVar__0 IN {std::json_array_unpack(to_json($$[{"title":"Black Widow $$$*","genre":"Action","rating":5}]$$))} UNION ( (INSERT default::Movie { title := (<std::str>std::json_get(__forVar__0, "title")), genre := (<default::Genre>std::json_get(__forVar__0, "genre")), rating := (<std::int16>std::json_get(__forVar__0, "rating")) }) )
Gives you the following runtime error:
EdgeQLSyntaxError: bare $ is not allowed
Creating a JSON literal with
e.json
wraps your string in$$
to handle multiline strings, as noted in the docs:Here's an example of a failing query:
Generates:
Gives you the following runtime error: