title: Jackson custom deserialization - can't read JsonParser twice
body: <p>I am trying to implement a Jackson Deserializer to have a way of migrating JSONs when they change (like a renamed field, for example, where I would need to read a now inconsistent JSON into a consistent one).</p>
  
  <p>One way of doing this would be to create a JsonDeserializer, read the JSON as the proper final class, then read it again as a MAP, to cherry pick the changes.</p>
  
  <p>I can't seem to do that though, because everytime I read or deserialize the JSON, the backing Stream closes.</p>
  
  <pre><code>class CustomDeserializer extends StdDeserializer&lt;MyPOJO&gt; implements ResolvableDeserializer{
  
      private final JsonDeserializer&lt;?&gt; deserializer;
      private final ObjectMapper mapper;
  
      public CustomDeserializer(JsonDeserializer&lt;?&gt; deserializer, ObjectMapper mapper) {
          super(MyPOJO.class);
          this.deserializer = deserializer;
          this.mapper = mapper;
      }
  
      @Override
      public MyPOJO deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
          MyPOJO deserialized = (MyPOJO) deserializer.deserialize(jp, ctxt);
          // Custom migration would go here...
          return deserialized;
      }
  
      @Override
      public void resolve(DeserializationContext ctxt) throws JsonMappingException {
          ((ResolvableDeserializer) deserializer).resolve(ctxt);
      }
  }
  </code></pre>
  
  <p>I am avoiding creating new ObjectMapper because there is already a customized one, with a custom Date deserializer, for example, so when I am using MyPOJO custom deserializer I want to be able to somehow delegate the deserialization in some way so it uses all previous configuration.</p>