JSON_EXTRACT
Complete JSON_EXTRACT() reference: JSON_EXTRACT(json_doc, path[, path]...) syntax, JSONPath arguments, NULL/error behavior, and multi-match array autowrap.
Syntax
JSON_EXTRACT(json_doc, path[, path] ...)Description
Examples
SET @json = '[1, 2, [3, 4]]';
SELECT JSON_EXTRACT(@json, '$[1]');
+-----------------------------+
| JSON_EXTRACT(@json, '$[1]') |
+-----------------------------+
| 2 |
+-----------------------------+
SELECT JSON_EXTRACT(@json, '$[2]');
+-----------------------------+
| JSON_EXTRACT(@json, '$[2]') |
+-----------------------------+
| [3, 4] |
+-----------------------------+
SELECT JSON_EXTRACT(@json, '$[2][1]');
+--------------------------------+
| JSON_EXTRACT(@json, '$[2][1]') |
+--------------------------------+
| 4 |
+--------------------------------+See Also
Last updated
Was this helpful?

