Implemented suggestions from code review r432 by adding a JsonNull for primitives if the value is null.
This commit is contained in:
parent
c64b79c0f9
commit
1dcdd3fb3f
@ -135,10 +135,8 @@ final class JsonSerializationVisitor implements ObjectNavigator.Visitor {
|
||||
}
|
||||
|
||||
public void visitPrimitive(Object obj) {
|
||||
if (obj != null) {
|
||||
JsonElement json = new JsonPrimitive(obj);
|
||||
assignToRoot(json);
|
||||
}
|
||||
JsonElement json = obj == null ? JsonNull.createJsonNull() : new JsonPrimitive(obj);
|
||||
assignToRoot(json);
|
||||
}
|
||||
|
||||
private void addAsChildOfObject(Field f, Type fieldType, Object fieldValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user