JSON_EXTRACT returns the sub-JSON document at the specified path, and otherwise, returns NULL.
Syntax
Aliases
Parameters
Return Type
TEXT
- If any input values are
NULL, the function will returnNULL.
Examples
For the JSON document used in the examples below, see JSON common example. Example The following code example extracts the value at the path/value/dyid from the JSON document using the JSONPointer syntax and returns "987":
Rows: 1Execution time: 4.86ms
/value/no_such_key and returns NULL because the key does not exist:
Rows: 1Execution time: 4.98ms
/value/uid using the JSON_POINTER_EXTRACT alias and returns '"987654"' with double quotes, indicating it is a JSON string:
Rows: 1Execution time: 8.19ms
/value/keywords using the JSON_POINTER_EXTRACT alias:
Rows: 1Execution time: 6.28ms
2 from the keywords array using zero-based indexing:
Rows: 1Execution time: 5.55ms