I am using JSON_ARRAY_APPEND
to update an array object in an existing entry in the table.
I am doing it via code and query looks as below:
UPDATE table t1
SET t1.value = JSON_ARRAY_APPEND('[]', '$', JSON_OBJECT('desc', '${desc}',
'hosts', '[${hosts}]'))
WHERE t1.key = '${key1}
My resulting value
looks as below:
[{"desc": "this is desc", "hosts": "[host1,host2, host3]"}]
Desired Output for value
is:
[{"desc": "this is desc", "hosts": ["host1","host2","host3"]"}]