Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

petritr's avatar
Level 15

query json column

I have an column like this: "data": "[{"value":"0"},{"value":"3"}]"

column name data with json data, how can i query json data in orWhere query

I have something like this that doesn't work, i have tried may things no success, what im doing wrong ?

orWhereRaw('JSON_CONTAINS(data->"$.value", \'["0"]\')');
0 likes
1 reply
petritr's avatar
Level 15

For someone else who might have the same problem

  whereRaw('JSON_CONTAINS(`data`, \'{"value":"'.$value.'"}\')');
1 like

Please or to participate in this conversation.