JSONPath: How to test unordered array equality? #1903
-
|
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? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Hi,
(if I'm not mistaken |
Beta Was this translation helpful? Give feedback.
Hi,
jsonpath "$.objects[*].working.input.name"returns a collection so you could do this:(if I'm not mistaken☺️ )