Skip to content

JSON.ARRINDEX not returning indices from multiple arrays #466

Closed

Description

@oshadmi

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]"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions