- Add JSR223 PostProcessor as a child of the request which returns this JSON response
-
Put the following code into “Script” area:
def json = new groovy.json.JsonSlurper().parse(prev.getResponseData()) for (Iterator<Map.Entry> it = json.entrySet().iterator(); it.hasNext();) { Map.Entry entry = it.next(); if (entry.getValue() == null) { it.remove() } } vars.put("data", new groovy.json.JsonBuilder(json).toPrettyString())
-
JSON data without “null” elements will be available as
${data}
JMeter Variable.
References:
1
solved How to remove null values from JSON response