JSON_REPLACE()
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 @j = '{ "a": 1, "b": [2, 3]}';
SELECT JSON_REPLACE(@j, '$.a', 10, '$.c', '[true, false]');
+-----------------------------------------------------+
| JSON_REPLACE(@j, '$.a', 10, '$.c', '[true, false]') |
+-----------------------------------------------------+
| {"a": 10, "b": [2, 3]} |
+-----------------------------------------------------+
SET @json = '{ "a": 1, "b": [2, 3],"c":[3]}';
SELECT JSON_REPLACE(@json, '$.a', 2, '$.b', '[true, false]','$.c','C');
+-----------------------------------------------------------------+
| JSON_REPLACE(@json, '$.a', 2, '$.b', '[true, false]','$.c','C') |
+-----------------------------------------------------------------+
| {"a": 2, "b": "[true, false]", "c": "C"} |
+-----------------------------------------------------------------+
SET @json = '{ "a": 1, "b": [2, 3],"c":[3]}';
SELECT JSON_REPLACE(@json, '$.a', 2, '$.b', '[true, false]','$.c','C','$.d','[1,2,3]');
+---------------------------------------------------------------------------------+
| JSON_REPLACE(@json, '$.a', 2, '$.b', '[true, false]','$.c','C','$.d','[1,2,3]') |
+---------------------------------------------------------------------------------+
| {"a": 2, "b": "[true, false]", "c": "C"} |
+---------------------------------------------------------------------------------+
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.