Answers for "how to update json oject key in mysql"

0

updating json object in mysql database

SET @data = '{  
    "Person": {    
       "Name": "Homer", 
       "Hobbies": ["Eating", "Sleeping"]  
    }
 }';
SELECT JSON_SET(@data, '$.Person.Name', 'Bart', '$.Person.Hobbies[1]', "Mischief") AS 'Result';
Posted by: Guest on April-22-2020
0

how to update json key name while keeping the values in mysql

UPDATE `my_table` 
SET `my_col` = JSON_INSERT(
                           JSON_REMOVE(my_col, '$.oldKeyValue'), 
                           '$.newKeyValue', 
                           JSON_EXTRACT(my_col, '$.oldKeyValue')
                          );
Posted by: Guest on November-05-2020

Code answers related to "how to update json oject key in mysql"

Code answers related to "Javascript"

Browse Popular Code Answers by Language