File tree 1 file changed +13
-0
lines changed
src/test/java/org/json/junit
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,19 @@ public void verifyConstructor() {
228
228
Util .checkJSONArrayMaps (jaRaw );
229
229
Util .checkJSONArrayMaps (jaInt );
230
230
}
231
+
232
+ @ Test
233
+ public void jsonArrayByListWithNestedNullValue () {
234
+ List <Map <String , Object >> list = new ArrayList <Map <String , Object >>();
235
+ Map <String , Object > sub = new HashMap <String , Object >();
236
+ sub .put ("nullKey" , null );
237
+ list .add (sub );
238
+ JSONParserConfiguration parserConfiguration = new JSONParserConfiguration ().withJavaNullAsJsonNull (true );
239
+ JSONArray jsonArray = new JSONArray (list , parserConfiguration );
240
+ JSONObject subObject = jsonArray .getJSONObject (0 );
241
+ assertTrue (subObject .has ("nullKey" ));
242
+ assertEquals (JSONObject .NULL , subObject .get ("nullKey" ));
243
+ }
231
244
232
245
/**
233
246
* Tests consecutive calls to putAll with array and collection.
You can’t perform that action at this time.
0 commit comments