Ignacio Degeneffe
Ignacio Degeneffe

Reputation: 85

problems evaluating json with karate

I'm running this feature:

* def data = { foo: [{ bar: 1, baz: 'a', bax:[{bav : 's'}] }, { bar: 2, baz: 'b' , bax:[{bav : 's'}]}, { bar: 3, baz: 'c', bax:[{bav : 's'}] }]}
* match each data.foo[*].bav == '#number'

and it's working.

How is it possible?

Any idea?

Upvotes: 1

Views: 64

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Yep, because your JsonPath is wrong. Try:

* match each data..bav == '#number'

Note that a match each on an empty array will always pass.

* def temp = []
* match each temp = 'foo'

Upvotes: 1

Related Questions