public JsonObject removeNulls ( JsonObject object ) { for ( int j = 0 ; j < object . names ( ) . size ( ) ; j ++ ) { if ( JsonType . OBJECT . equals ( object . get ( object . names ( ) . get ( j ) ) . getType ( ) ) ) { removeNulls ( object . get ( object . names ( ) . get ( j ) ) . asObject ( ) ) ; } else { if ( object . get ( object . names ( ) . get ( j ) ) . isNull ( ) ) { object . set ( object . names ( ) . get ( j ) , "TO_BE_NULL" ) ; } } } return object ; }
Eliminates null occurrences replacing them with TO_BE_NULL