Comments - JSON_INSERT

2 years, 1 month ago Markus Mäkelä

You can use JSON_EXTRACT for it:

MariaDB [test]> SET @j = '{ "a": 1, "b": [2, 3]}';
Query OK, 0 rows affected (0.000 sec)

MariaDB [test]> SELECT JSON_INSERT(@j, '$.a', 10, '$.c', JSON_EXTRACT('[true, false]', '$'));
+-----------------------------------------------------------------------+
| JSON_INSERT(@j, '$.a', 10, '$.c', JSON_EXTRACT('[true, false]', '$')) |
+-----------------------------------------------------------------------+
| {"a": 1, "b": [2, 3], "c": [true, false]}                             |
+-----------------------------------------------------------------------+
1 row in set (0.000 sec)

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.