SQLite JSON Functions
SQLite supports JSON data type, and this page organizes JSON-related functions and operators in SQLite.
-
json
The SQLitejson()
function validates the string specified by the parameter and converts it to a minimal JSON string, with all unnecessary whitespace removed. -
json_array
The SQLitejson_array()
function evaluates all the values in the parameters list and returns a JSON array containing all the parameters. -
json_array_length
The SQLitejson_array_length()
function returns the length of elements in the specified JSON array, that is the number of the top level child elements in the JSON array. -
json_each
The SQLitejson_each()
function walks the specified JSON document, generates a row for each top child element, and returns a result set consisting of all the rows. -
json_extract
The SQLitejson_extract()
function extracts the value specified by the path expression from the JSON document and returns it. -
json_group_array
The SQLitejson_group_array()
function is an aggregate function that returns a JSON array containing all the values in a group. -
json_group_object
The SQLitejson_group_object()
function is an aggregate function that returns a JSON object containing the key-value pairs of the specified columns in a group. -
json_insert
The SQLitejson_insert()
function inserts values into a JSON document and return a new JSON document. -
json_object
The SQLitejson_object()
function returns a JSON object containing all the key-value pairs specified by the parameters. -
json_patch
The SQLite json_patch() function merges and patchs the second JSON object to the original JSON object, and returns the patched original JSON object. -
json_quote
The SQLitejson_quote()
function converts the SQL value specified by the parameter to the corresponding JSON representation. -
json_remove
The SQLitejson_remove()
function removes the data specified by a path from a JSON document and returns the modified JSON document. -
json_replace
The SQLitejson_replace()
function replaces existing data in a JSON document and return modified JSON document. -
json_set
The SQLitejson_set()
function inserts or updates data in a JSON document and return the modified JSON document. -
json_tree
The SQLitejson_tree()
function recursively walks the specified JSON document, generates a row for each child element (including the parameter itself), and returns a result set consisting of all the rows. -
json_type
The SQLitejson_type()
returns the type of a JSON value or the value of the specified path in JSON document. -
json_valid
The SQLitejson_valid()
unction returns 0 or 1 to indicate whether the given parameter is a valid JSON document.