I am trying to remove a value from a json array, however I am having issues.
First I insert the array into into the table like so:
INSERT into demo (hint) VALUES ('["Hello","World"]');
Next when I run this query, the World value gets removed which is what is supposed to happen. However if I run it a second time, then the Hello value gets removed which is not supposed to happen. What am I doing wrong, or what is a better way to remove items from a json array?
UPDATE demo SET hint = json_remove(
hint,
(SELECT json_each.fullkey FROM demo, json_each(demo.hint) WHERE json_each.value = 'World')
);
select * from demo;