using jsonPath() to check json objects

I’m trying to test an API which returns json data. I want to check that a returned json object contains expected properties. I’m using jsonPath() to extract the data from the response body and check it against a session property injected by a data feeder.

Example Feeder Data:

I’ve been researching this more and I think I need to create a custom validator. Does anyone have some example code of a custom validator?

is the ‘shape’ of the returned object always the same? ie - are you only looking to “cn” and “id”?

if so, you could just have two json checks if you restructure your feeder



and then


The shape of the object changes. It is not always the same. That is the challenge. I think I need to create a custom gatling validator that can compare object equivalence, instead of exact string matches. Unfortunately, my scala knowledge is limited, but growing.

I’ve been reviewing the validator code ( but it is slow going.

Thanks for the reply!