Skip to content

Serialize formerly unserializable Jackson types like ObjectMapper as Empty Object value #3302

@cowtowncoder

Description

@cowtowncoder

(note: actual changes were done as part of fix for #3244 - this is for documenting side effects)

With Jackson 2.x up to 2.12 a few central processing entities are not serializable by Jackson itself: they cannot be deserialized due to state, and sometimes contain problematic things like cyclic references, resulting in various Exceptions or even errors (like StackOverflowError) being thrown.

But while they cannot be deserialized there is no reason why they could not be serialized using a placeholder value like Empty Object ({ } in case of JSON).
So let's do that for following types (and their subtypes)

  • ObjectMapper (and format-specific subtypes)
  • ObjectReader
  • ObjectWriter
  • DatabindContext (subtypes SerializerProvider, DeserializationContext)
  • TokenStreamFactory (subtypes JsonFactory etc)
  • JsonParser (and format-specific subtypes)
  • JsonGenerator (and format-specific subtypes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions