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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -