How can I verify that a JSON object contains a key?In the following JSON object the age is missing for the second person, Kevin:
[
{
"name":"John",
"age":30
},
{
"name":"Kevin"
}
] If I query the JSON Path
and check expected value for
then then Kevin's object gets silently ignored.
- I know Jayway's JsonPath, which afaik the JSON Path Assertion plugin is
using, has an option (DEFAULT_PATH_LEAF_TO_NULL) to show missing leaves as null. For this case I have already a query to recognize objects with null values. But I don't know how
to activate this option in the plugin.
- Is there another way to check for missing keys? A query or setting in the plugin itself?