Reputation: 49
I have a table with JSON data like this:
{"entries": [{"color": "blue", "value": 15, "name": "john"}, {"color": "red", "value": 30, "name": "doe"}]}
I need to remove the object in the array that has value x.
The code I have so far is:
SELECT data_source, JSON_EXTRACT('$.entries[*].value')
Which allows me to see all the values in an array.
I would like to do something like:
SELECT JSON_REMOVE(data_source, '$.entries[*].use_id') = x
How can I create a JSON path that would allow me to find the value? And then remove that object it's in?
Upvotes: 0
Views: 15