JSON.ARRINDEX
Since 1.1.0JSON
Syntax
JSON.ARRINDEX key path value [start [stop]]Returns the index of the first element equal to value, JSON text, in each array path matches, from start to stop. stop is excluded, and 0 means the end.
Reply
- The indexes;
-1where there is no such element.
Examples
> JSON.SET d $ '{"tags":["math","code"]}'
OK
> JSON.ARRINDEX d $.tags '"code"'
1) (integer) 1
> JSON.ARRINDEX d $.tags '"none"'
1) (integer) -1