JSON functions were added in MariaDB 10.2.3.
JSON_INSERT(json_doc, path, val[, path, val] ...)
Inserts data into a JSON document, returning the resulting document or NULL if any argument is null.
An error will occur if the JSON document is not invalid, or if any of the paths are invalid or contain a *
or **
wildcard.
JSON_INSERT can only insert data while JSON_REPLACE can only update. JSON_SET can update or insert data.
SET @json = '{ "A": 0, "B": [1, 2]}'; SELECT JSON_INSERT(@json, '$.C', '[3, 4]'); +--------------------------------------+ | JSON_INSERT(@json, '$.C', '[3, 4]') | +--------------------------------------+ | { "A": 0, "B": [1, 2], "C":"[3, 4]"} | +--------------------------------------+
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/json_insert/