TEXT value.
For JSON strings, removes the outermost quotes and unescapes the values.
Other JSON scalars are not changed.
Returns a SQL NULL if a non-scalar value is given.
For TEXT input, this function pairs with the JSON_EXTRACT function, which doesn’t convert the JSON values to SQL values.
Syntax
Parameters
Return Type
TEXT
- If any of the input is
NULLthe output isNULL(propagates nulls).
Examples
For the JSON document used in the examples below, see JSON common example. Example The following example returns987654 (unquoted) from JSON_VALUE and "987654" (with quotes) from JSON_POINTER_EXTRACT:
Rows: 1Execution time: 7.72ms
INT:
Rows: 1Execution time: 5.22ms
NULL because /value/keywords contains a JSON array, not a scalar:
Rows: 1Execution time: 5.47ms
NULL for a NULL input:
Rows: 1Execution time: 6.12ms