Mysql table JSON field, I want to query the costCenterId of the objects in the products array in this field is equal to a value, how to write path?

clipboard.png
productspath
:

clipboard.png

content:

clipboard.png

Jul.06,2021

solution
1. If you have administrator privileges, it is recommended that you upgrade to mysql5.7,. This is the best way to query the array in json
2. Use mysql function, if like (hit rate is low), use regular REGEXP, to take the last sentence of your screenshot sql as an example

AND content REGEXP '{costCenterId:".*"}' // 

after research, I have found a solution, which is as follows:

clipboard.png

sql


clipboard.png
is there illegal content in my field, or is there a limit to using this?

Menu