1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Add the json_check() function, which returns its argument if the argument

is well-formed JSON or which throws an error otherwise.

FossilOrigin-Name: 64abb65d4df11e5b3bcc4afc8e7c18e907c6080a
This commit is contained in:
drh
2015-08-28 03:48:04 +00:00
parent ecb5fedb3f
commit f6ec8d4f4c
4 changed files with 38 additions and 8 deletions

View File

@ -63,4 +63,11 @@ do_execsql_test json1-3.4 {
SELECT json_type(json_set('{"a":1,"b":2}','$$.b','{"x":3,"y":4}'),'$.b');
} {object}
do_execsql_test json1-4.1 {
SELECT json_check(' [ 1, 2] ');
} {[1,2]}
do_catchsql_test json1-4.2 {
SELECT json_check(' [ 1, 2 ');
} {1 {malformed JSON}}
finish_test