title: How to deserialize JSON null to a NullNode instead of Java null?
body: <p>Note: Jackson 2.1.x.</p>
  
  <p>The problem is quite simple but I could not find a solution so far. I have browsed through existing documentation etc and could not find an answer.</p>
  
  <p>The base class is this:</p>
  
  <pre><code>@JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "op")
  
  @JsonSubTypes({
      @Type(name = "add", value = AddOperation.class),
      @Type(name = "copy", value = CopyOperation.class),
      @Type(name = "move", value = MoveOperation.class),
      @Type(name = "remove", value = RemoveOperation.class),
      @Type(name = "replace", value = ReplaceOperation.class),
      @Type(name = "test", value = TestOperation.class)
  })
  
  public abstract class JsonPatchOperation
  {
      /*
       * Note: no need for a custom deserializer, Jackson will try and find a
       * constructor with a single string argument and use it
       */
      protected final JsonPointer path;
  
      protected JsonPatchOperation(final JsonPointer path)
      {
          this.path = path;
      }
  
      public abstract JsonNode apply(final JsonNode node)
          throws JsonPatchException;
  
      @Override
      public String toString()
      {
          return "path = \"" + path + '"';
      }
  }
  </code></pre>
  
  <p>And the problematic class is this:</p>
  
  <pre><code>public abstract class PathValueOperation
      extends JsonPatchOperation
  {
      protected final JsonNode value;
  
      protected PathValueOperation(final JsonPointer path, final JsonNode value)
      {
          super(path);
          this.value = value.deepCopy();
      }
  
      @Override
      public String toString()
      {
          return super.toString() + ", value = " + value;
      }
  }
  </code></pre>
  
  <p>When I try to deserialize:</p>
  
  <pre><code>{ "op": "add", "path": "/x", "value": null }
  </code></pre>
  
  <p>I'd like the null value to be deserialized as a <code>NullNode</code>, not Java null. And I couldn't find a way to do it so far.</p>
  
  <p>How do you achieve that?</p>
  
  <p>(note: all constructors of concrete classes are <code>@JsonCreator</code>s with the appropriate <code>@JsonProperty</code> annotations -- they work without problem, my only problem is JSON null handling)</p>