It seems as json() and json_valid() misbehave about unescaped
backslashes. json() creates invalid JSON, and json_valid() happily
accepts it:
$ sqlite3
SQLite version 3.15.1 2016-11-04 12:08:49
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> select json('" \ "'); -- Creates invalid JSON
" \ "
sqlite> select json('" \\ "');
" \\ "
sqlite> select json_valid('" \ "'); -- Accepts invalid JSON
1
sqlite> select json_quote('\'); -- Works correctly
"\\"
sqlite>
$ sqlite3 :memory: "select json('\" \\ \"');"
" \ "
$ sqlite3 :memory: "select json('\" \\ \"');" | json_verify
lexical error: inside a string, '\' occurs before a character which it
may not.
" \ "
(right here) ------^
JSON is invalid
$
It's been like this since JSON arriveed in v3.9.0.
And oh, thanks for creating this wonderful piece of software.
Regards,
Øyvind
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users