I have a problem in my custom deserializer in Jackson. I want to access the default serializer to populate the object I am deserializing into. After the population I will do
Along the lines of what Tomáš Záluský has suggested, in cases where using BeanDeserializerModifier
is undesirable you can construct a default deserializer yourself using BeanDeserializerFactory
, although there is some extra setup necessary. In context, this solution would look like so:
public User deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
ObjectCodec oc = jp.getCodec();
JsonNode node = oc.readTree(jp);
User deserializedUser = null;
DeserializationConfig config = ctxt.getConfig();
JavaType type = TypeFactory.defaultInstance().constructType(User.class);
JsonDeserializer