title: How to delegate to default deserialization in custom deserializer in Jackson?
body: <p>Suppose I am writing custom serialization for some class, but would like to process one of its field with default methods.</p>
  
  <p>How to do that?</p>
  
  <p>While serializing we have <a href="http://fasterxml.github.io/jackson-core/javadoc/2.3.0/com/fasterxml/jackson/core/JsonGenerator.html#writeObjectField(java.lang.String,%20java.lang.Object)" rel="noreferrer"><code>JsonGenerator#writeObjectField()</code></a>.</p>
  
  <p>But what is corresponding method for deserialization? </p>
  
  <p>Regard the code below:</p>
  
  <pre><code>import com.fasterxml.jackson.core.*;
  import com.fasterxml.jackson.databind.*;
  import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
  import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  
  import java.io.IOException;
  import java.util.Objects;
  
  public class TryDelegate {
  
     public static class MyOuterClassSerializer extends JsonSerializer&lt;MyOuterClass&gt; {
  
        @Override
        public void serialize(MyOuterClass value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
           gen.writeStartObject();
  
           gen.writeObjectField("inner", value.getInner());
  
           gen.writeEndObject();
        }
     }
  
     public static class MyOuterClassDeserializer extends JsonDeserializer&lt;MyOuterClass&gt; {
        @Override
        public MyOuterClass deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
  
  
           MyOuterClass ans = new MyOuterClass();
  
           JsonToken token;
  
           token = p.getCurrentToken();
           if( token != JsonToken.START_OBJECT ) {
              throw new JsonParseException("Start object expected", p.getCurrentLocation());
           }
  
           if( !"inner".equals(p.nextFieldName() ) ) {
              throw new JsonParseException("'inner; field expected", p.getCurrentLocation());
           }
  
           MyInnerClass inner = null;// how to desrialize inner from here with default processing???
           ans.setInner(inner);
  
           token = p.nextToken();
           if( token != JsonToken.END_OBJECT ) {
              throw new JsonParseException("End object expected", p.getCurrentLocation());
           }
  
           return ans;
  
        }
     }
  
     public static class MyInnerClass {
        private int value;
  
        public int getValue() {
           return value;
        }
  
        public void setValue(int value) {
           this.value = value;
        }
  
        @Override
        public String toString() {
           return "{\"value\":" + value + "}";
        }
     }
  
     @JsonDeserialize(using = MyOuterClassDeserializer.class)
     @JsonSerialize(using = MyOuterClassSerializer.class)
     public static class MyOuterClass {
  
        private MyInnerClass inner;
  
        public MyInnerClass getInner() {
           return inner;
        }
  
        public void setInner(MyInnerClass inner) {
           this.inner = inner;
        }
  
        @Override
        public String toString() {
           return "{\"inner\":" + Objects.toString(inner) + "}";
        }
     }
  
     public static void main(String[] args) throws IOException {
  
        ObjectMapper mapper = new ObjectMapper();
        String string;
  
        MyInnerClass inner = new MyInnerClass();
        inner.setValue(12);
  
        MyOuterClass outer = new MyOuterClass();
        outer.setInner(inner);
  
        string = mapper.writeValueAsString(outer);
        System.out.println(string);
  
        MyOuterClass outer2 = mapper.readValue(string, MyOuterClass.class);
        System.out.println(outer2); // inner was not deserialized
  
  
     }
  }
  </code></pre>
  
  <p>How to implement <code>MyOuterDeserializer</code>?</p>