How do I update a nested json object in mysql relative to a value -
how update nested json object in mysql relative value.
if have input , want output.
input
[{ "name": "logo", "settings": [] }, { "name": "other", "settings": [] }]
output
[{ "name": "logo", "settings": [{ "name": "purpose", "value": "logo" }] }, { "name": "other", "settings": [] }]
i've been able if know index (0) of object want update. index change.
select json_extract('[{"name": "logo","settings": []},{"name": "other","settings": []}]', '$[*].name'); select json_insert('[{"name": "logo","settings": []},{"name": "other","settings": []}]', '$[0].settings[1]', json_object("name", "purpose", "value", "logo"));
thanks
Comments
Post a Comment