Skip to content
Advertisement

how to find the position of string search in a json array column in laravel

i have a query which returns boolean value from a json array column about whether the string i am searching exists or not

the column is something liek this —— [“a”,”b”,”c”] and the query is below

but i want to get the position where the string was found… lets say for this it should return 1.

please help.

Advertisement

Answer

It will give you the output as "$[1]" "" are part of the output string. So you need to get the number between [] to get the index of the item in the array.

OR

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement