Module functions

Source
Available on crate feature sqlite only.
Expand description

SQLite specific functions

Functions§

json
Verifies that its argument is a valid JSON string or JSONB blob and returns a minified version of that JSON string with all unnecessary whitespace removed.
json_array_length
The json_array_length(X) function returns the number of elements in the JSON array X, or 0 if X is some kind of JSON value other than an array. Errors are thrown if either X is not well-formed JSON or if P is not a well-formed path.
json_array_length_with_path
The json_array_length(X) function returns the number of elements in the JSON array X, or 0 if X is some kind of JSON value other than an array. The json_array_length(X,P) locates the array at path P within X and returns the length of that array, or 0 if path P locates an element in X that is not a JSON array, and NULL if path P does not locate any element of X. Errors are thrown if either X is not well-formed JSON or if P is not a well-formed path.
json_error_position
The json_error_position(X) function returns 0 if the input X is a well-formed JSON or JSON5 string. If the input X contains one or more syntax errors, then this function returns the character position of the first syntax error. The left-most character is position 1.
json_group_array
The json_group_array(X) function is an aggregate SQL function that returns a JSON array comprised of all X values in the aggregation.
json_pretty
Converts the given json value to pretty-printed, indented text
json_pretty_with_indentation
Converts the given json value to pretty-printed, indented text
json_quote
The json_quote(X) function converts the SQL value X (a number or a string) into its corresponding JSON representation. If X is a JSON value returned by another JSON function, then this function is a no-op.
json_type
The json_type(X) function returns the “type” of the outermost element of X. The “type” returned by json_type() is one of the following SQL text values: ‘null’, ‘true’, ‘false’, ‘integer’, ‘real’, ‘text’, ‘array’, or ‘object’.
json_type_with_path
The json_type(X,P) function returns the “type” of the element in X that is selected by path P. If the path P in json_type(X,P) selects an element that does not exist in X, then this function returns NULL.
json_valid
Returns true if the argument is well-formed JSON, or returns false if is not well-formed.
jsonb
The jsonb(X) function returns the binary JSONB representation of the JSON provided as argument X.
jsonb_group_array
The jsonb_group_array(X) function is an aggregate SQL function that returns a JSONB array comprised of all X values in the aggregation.

Type Aliases§

json
The return type of json()
json_array_length
The return type of json_array_length()
json_array_length_with_path
The return type of json_array_length_with_path()
json_error_position
The return type of json_error_position()
json_group_array
The return type of json_group_array()
json_pretty
The return type of json_pretty()
json_pretty_with_indentation
The return type of json_pretty_with_indentation()
json_quote
The return type of json_quote()
json_type
The return type of json_type()
json_type_with_path
The return type of json_type_with_path()
json_valid
The return type of json_valid()
jsonb
The return type of jsonb()
jsonb_group_array
The return type of jsonb_group_array()