SQLite Forum

Unexpected behaviour of the json_valid function and .json mode in CLI
According to [the doc for json_valid()](https://sqlite.org/json1.html#jvalid), "The json_valid(X) function return 1 if the argument X is well-formed JSON".

The function first converts its argument to a string (via sqlite3_text_value()), which results in then testing '42' to see if it is well-formed JSON. According to [the JSON spec you cited](https://www.json.org/json-en.html), it is. (See railroad chart for **value**, branch **number**.) The json_valid() function says it is valid JSON, it is actually valid JSON, hence there is no problem and the behavior should be expected.