You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an API which returns a collection of JSON objects and I want to check their values. I can check that the values exist within the collection with:
jsonpath "$.books[*].title includes "Introduction to Algorithms"
jsonpath "$.books[*].author includes "Thomas H. Cormen"
but I can not confirm that the these values are within the same object.
Proposal
Allow the includes predicate to check for a object within a collection, i.e for the collection:
books: [
{
"title": "Introduction to Algorithms",
"author": "Thomas H. Cormen",
"publisher": "The MIT Press"
},
...
]
You can check with an object:
jsonpath "$.books includes
{
"title": "Introduction to Algorithms",
"author": "Thomas H. Cormen",
}
or one in a variable:
jsonpath "$.books includes {{myAwesomeBook}}
This would return true even if the object in the collection has additional keys. i.e. the above examples would return True.
Additional context and resources
There could be a keyword instead of the newline to invoke this behavior, possibly object?
The text was updated successfully, but these errors were encountered:
Problem to solve
I have an API which returns a collection of JSON objects and I want to check their values. I can check that the values exist within the collection with:
but I can not confirm that the these values are within the same object.
Proposal
Allow the includes predicate to check for a object within a collection, i.e for the collection:
You can check with an object:
or one in a variable:
This would return true even if the object in the collection has additional keys. i.e. the above examples would return True.
Additional context and resources
object
?The text was updated successfully, but these errors were encountered: