JSONPath: How to test unordered array equality? #1903
Answered
by
jcamiel
ens-scmeeu
asked this question in
Q&A
|
I'm trying to validate that the This is what I tried to do, but it didn't parse (it can't seem to parse the JSON array - regardless I don't think this would do unordered compare anyway): jsonpath "$.objects[*].working.input.name" == ["foo", "bar"]This works currently (but it is a brittle test if the ordering of the array changes): jsonpath "$.objects[0].working.input.name" == "foo"
jsonpath "$.objects[1].working.input.name" == "bar"Any other way to do this compare in an order agnostic way? |
Answered by
jcamiel
Sep 8, 2023
Replies: 1 comment 3 replies
|
Hi,
(if I'm not mistaken |
3 replies
Answer selected by
ens-scmeeu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
jsonpath "$.objects[*].working.input.name"returns a collection so you could do this:(if I'm not mistaken☺️ )