Skip to content

JSON.ARRINDEX not returning indices from multiple arrays #466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oshadmi opened this issue Oct 3, 2021 · 0 comments · Fixed by #473
Closed

JSON.ARRINDEX not returning indices from multiple arrays #466

oshadmi opened this issue Oct 3, 2021 · 0 comments · Fixed by #473

Comments

@oshadmi
Copy link
Collaborator

oshadmi commented Oct 3, 2021

JSON.ARRINDEX should return multiple indices
(Related to #460)

json.set store $ '{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95,"size":[10,20,30,40]},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99,"size":[50,60,70,80]},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99,"size":[5,10,20,30]},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99,"size":[5,6,7,8]}],"bicycle":{"color":"red","price":19.95}}}'
OK

json.get store '$.store.book[?(@.price<10)].size' 
"[[10,20,30,40],[5,10,20,30]]"

json.arrindex store '$.store.book[?(@.price<10)].size' 20
(integer) 1

Should return something like

json.arrindex store '$.store.book[?(@.price<10)].size' 20
"[1,2]"

Or with concrete paths (in an object)

json.arrindex store '$.store.book[?(@.price<10)].size' 20
"{\"$.store.book[0].size\":1,\"$.store.book[2].size\":2}"

Or with concrete paths (in an array)

json.arrindex store '$.store.book[?(@.price<10)].size' 20
"[\"$.store.book[0].size\",1,\"$.store.book[2].size\",2]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant