json - @JsonIgnore doesn't work in Scala case class -
i have simple case class
case class project(@jsonignore id: option[uuid], name: option[string])
i using com.fasterxml.jackson
com.fasterxml.jackson.core:jackson-databind:2.8.4 com.fasterxml.jackson.core:jackson-annotations:2.8.4 org.skinny-framework.com.fasterxml.jackson.module:jackson-module-scala_2.12:2.8.4
...
private val mapper = new objectmapper() mapper.registermodule(defaultscalamodule) mapper.configure(deserializationfeature.fail_on_unknown_properties, false) mapper.writevalueasstring(project)
writes id resulting json despite @jsonignore
what doing wrong?
update:
a current workaround:
@jsonignoreproperties(array("id")) case class project(id: option[uuid], name: option[string])
this works :)
Comments
Post a Comment