-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Deserializer Discovery 2.x
Tatu Saloranta edited this page Jan 29, 2024
·
19 revisions
This page describes the process of discovering {@code JsonDeserializer}s in Jackson 2.x
{@code JsonDeserializer}s are needed for reading JSON (and other supported formats) from {@code JsonParser} and constructing desired Java Objects. Discovery process is initiated by 3 main entities:
-
ObjectMapper
to locate deserializer to use for target type indicated forreadValue()
method (andreadValues()
,convertValue()
) -
ObjectReader
(similar toObjectMapper
) - Deserializers themselves, to locate "child deserializers": for example when deserializing
List
s, deserializer for elements contained is separate from deserializer forList
itself (and similarly for other structured types likejava.util.Map
s, Arrays, POJOs)
Discovery process for these cases is almost identical (and in fact, (1) and (2) are identical), differing only in that for (3), contextualization (via method DeserializationContext._handleSecondaryContextualization(...)
) passes referring property definition (BeanProperty
) whereas one does not exist for "root" values.