pjfanning / jackson-module-scala3-enum   2.14.0

Apache License 2.0 GitHub

Jackson support for Scala3 enums

Scala versions: 3.x


Build Status Maven Central

Jackson support for Scala3 enums.

libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala3-enum" % "2.13.3"
import com.github.pjfanning.`enum`.EnumModule

val mapper = JsonMapper.builder()

//old approach - will not work in Jackson 3
val mapper = new ObjectMapper()

The code uses toString on the enum instance to get the serialized value and when deserializing, valueOf(String) on the derived companion object is used. It may be possible to use Jackson annotations to modify this behaviour but there have been some issues with how the Scala 3 compiler handles Java annotations (some fixed but some still open).