I'm trying to search for userId value 22 from nested json in mysql column
My json is
'{ "data": [ {"calendarId":"11","userId": "12"}, {"calendarId":"21","userId": "22"} ] }'
I tried the following syntax:
1. where JSON_EXTRACT(column_field,'$.userId') = 22 2. where JSON_EXTRACT( column_field, '$.data[*].userId' ) = 22
this:
gives:
["12","22"]
and this:
gives:
Add a WHERE clause to find only the value
22
Should not be a problem.Note The above was tested using MySQL 8.x, see:DBFIDDLE