Skip to content

JSONPath: How to test unordered array equality? #1903

Answered by jcamiel
ens-scmeeu asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

jsonpath "$.objects[*].working.input.name"returns a collection so you could do this:

jsonpath "$.objects[*].working.input.name" includes "foo"
jsonpath "$.objects[*].working.input.name" includes "bar"
jsonpath "$.objects[*].working.input.name" count == 2
jsonpath "$.objects[*].working.input.name" isCollection
jsonpath "$.objects[*].working.input.name" nth 0 == "foo"
jsonpath "$.objects[*].working.input.name" nth 1 == "bar"
# etc....

(if I'm not mistaken ☺️)

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ens-scmeeu
Comment options

@jcamiel
Comment options

@ens-scmeeu
Comment options

Answer selected by ens-scmeeu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants