JSON_ TYPE
Returns the "type" of a JSON value as a string.
This function analyzes the JSON value (or a value within it at a specified path) and returns a text string indicating its type. The possible return strings are: 'null', 'true', 'false', 'integer', 'real', 'text', 'array', and 'object'.
If the json argument is NULL, or if the specified path does not locate a value within the JSON, the function returns NULL.
Note: 'true' and 'false' are returned for boolean values, not the string "boolean". Numbers with a decimal point or an exponent are 'real', otherwise 'integer'.
Example:
val jsonCol = jsonColumn("data") // Column with JSON '{"a": 1, "b": "hello", "c": [1,2]}'
// Get type of the root element
// SELECT JSON_TYPE(data) FROM MyTable;
// Result: 'object'
select(JSON_TYPE(jsonCol)).from(MyTable).execute()
// Get type of a specific value within the JSON
// SELECT JSON_TYPE(data, '$.b') FROM MyTable;
// Result: 'text'
select(JSON_TYPE(jsonCol, "$.b")).from(MyTable).execute()
// Get type of a value that doesn't exist
// SELECT JSON_TYPE(data, '$.d') FROM MyTable;
// Result: NULL
select(JSON_TYPE(jsonCol, "$.d")).from(MyTable).execute()Return
A KQLiteColumn of type String representing the type of the value, or NULL
Author
MOHAMMAD AZIM ANSARI
Parameters
The KQLiteJson column to analyze.
An optional path to a specific value within the JSON structure