I have a SQL column that contains JSON such as this
{
"tags":[
{"id":11,"x":99.12343123213,"y":88.123232},
{"id":12,"x":99.12343123213,"y":88.123232},
{"id":13,"x":99.12343123213,"y":88.123232}
]
}
I am trying to find a record with the value of '13', however the number of objects may vary. I know that i could use code similar to:
select * from Logs WHERE JSON_VALUE([log],'$.tags[0].id') LIKE '13'
Unfortunately, the number of objects in the array could be any number. How could I search through every object in my array for the value?
I am aware I could search through the string for the value of '%"id":13,%', however this seems like a messy solution.