Skip to content

CaseClassModule is incompatible with Options. #11

@nbauernfeind

Description

@nbauernfeind
def testJsonWithOption() {
  val mapper = new ObjectMapper()
  mapper.registerModule(new JacksonModule
    with CaseClassModule
    with EnumerationModule
    with SeqModule
    with IterableModule
    with TupleModule
    with MapModule
    with OptionModule
  )

  val writer = new StringWriter()
  mapper.writeValue(writer, Option(42))
  println(writer.toString)
}

That throws an exception. It works fine if I remove the CaseClassModule from the mixin. Do you know how I can fix this? Deserialization works fine. I really want a nested Option in my case class.

In fact the CaseClassModule by itself does not work properly with Options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions