diff --git a/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java b/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java
index <HASH>..<HASH> 100644
--- a/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java
+++ b/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java
@@ -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) {
Implemented suggestions from code review r<I> by adding a JsonNull for primitives if the value is null.