JSON_ARRAY_INSERT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Enterprise Server
Topics on this page:
Overview
A description for this Function has not yet been added to this Documentation.
EXAMPLES
SET @json = '["a", {"b": [1, 2]}, [3, 4]]';
SELECT JSON_ARRAY_INSERT(@json, '$[2]', 'c');
+---------------------------------------+
| JSON_ARRAY_INSERT(@json, '$[2]', 'c') |
+---------------------------------------+
| ["a", {"b": [1, 2]}, "c", [3, 4]] |
+---------------------------------------+
SET @json = '["a", {"b": [1, 2]}, [3, 4]]';
SELECT JSON_ARRAY_INSERT(@json, '$[10]', 'c');
+----------------------------------------+
| JSON_ARRAY_INSERT(@json, '$[10]', 'c') |
+----------------------------------------+
| ["a", {"b": [1, 2]}, [3, 4], "c"] |
+----------------------------------------+
SET @json = '["a", {"b": [1, 2]}, [3, 4]]';
SELECT JSON_ARRAY_INSERT(@json, '$[1].b[1]', 'B');
+--------------------------------------------+
| JSON_ARRAY_INSERT(@json, '$[1].b[1]', 'B') |
+--------------------------------------------+
| ["a", {"b": [1, "B", 2]}, [3, 4]] |
+--------------------------------------------+
SET @json = '["a", {"b": [1, 2]}, [3, 4]]';
SELECT JSON_ARRAY_INSERT(@json, '$[2][2]', 'c');
+------------------------------------------+
| JSON_ARRAY_INSERT(@json, '$[2][2]', 'c') |
+------------------------------------------+
| ["a", {"b": [1, 2]}, [3, 4, "c"]] |
+------------------------------------------+
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.