Allow to configure Java null handling.

This commit is contained in:
Robert Lichtenberger
2025-03-19 07:59:57 +01:00
parent 6452a6f38d
commit d1327c2da3
3 changed files with 72 additions and 1 deletions

View File

@@ -332,7 +332,7 @@ public class JSONObject {
throw new NullPointerException("Null key.");
}
final Object value = e.getValue();
if (value != null) {
if (value != null || jsonParserConfiguration.isJavaNullAsJsonNull()) {
testValidity(value);
this.map.put(String.valueOf(e.getKey()), wrap(value, recursionDepth + 1, jsonParserConfiguration));
}