JSON Null problem

I am working on a class that gets json values and saves them.
Then uses the saved attributes to dynamically make a the ¨.put¨ json.

basically

.check(jsonPath(“$.id”).saveAs(“Id”))
.check(jsonPath(“$.accepted”).saveAs(“accepted”))
.check(jsonPath(“$.totalAmount”).saveAs(“Amounts”))
.check(jsonPath(“$.totalCommission”).saveAs(“TotalCommission”))

everything works fine UNTIL…

one of the 100 accounts that I use has a NULL value.

{
“id”:11111,
“accepted”:false,
“revisionDetails”:{
“totalAmount”:“0.000000”,
“totalCommission”:null, <= (problem)

If I hard code null everything works, but then the other 99 users have a problem.

No attribute named 'TotalCommission´ 1 (50.00%)
is defined

I have tried different approches but am a little bit lost, because null needs to be in the json but I think it cannot be a attribute?

TNX

I want to do something like this, but do not know how to keep the null

.check(jsonPath("$.totalCommission")
.asLongAs("$.totalCommission", empty,)) {

saveAs(null)
}
else ("$.totalCommission" != null) {

saveAs(containing value)
}

?

The "No attribute named 'TotalCommission´ " happens where you’re trying to use this attribute, not where you’re trying to save it. And you didn’t provide this code.

Then, you might be looking for .exists() and .isUndefined() Gatling EL functions.
http://gatling.io/docs/2.0.2/session/expression_el.html#expression-language