By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select version();
version() |
---|
8.0.30 |
create table superheroes (
name varchar(32),
attributes JSON
);
insert into superheroes
values ('Batman', '{"dead": "false", "orphan": true, "billionaire": "true", "goodboy" : "true"}');
SELECT JSON_SEARCH((JSON_REPLACE(attributes,'$.orphan',"true")), 'all', 'true')
FROM superheroes
WHERE name = 'Batman';
JSON_SEARCH((JSON_REPLACE(attributes,'$.orphan',"true")), 'all', 'true') |
---|
["$.orphan", "$.goodboy", "$.billionaire"] |