Skip to content

Serializing Option with enableDefaultTyping fails #126

@mariussoutier

Description

@mariussoutier

The following code

case class User(name: String, email: Option[String] = None)

val mapper = new ObjectMapper()
mapper.registerModule(DefaultScalaModule)
mapper.enableDefaultTyping()

mapper.writeValueAsString(User("John Smith", Some("j.smith@example.com")))

will lead to this exception:

com.fasterxml.jackson.databind.JsonMappingException: Type id handling not implemented for type scala.Some (through reference chain: User["email"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions