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.



everything works fine UNTIL…

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

“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?


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

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

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.