Just upgraded Jackson from 1.9 to 2.1 and immediately noticed that @(JsonProperty@field) annotations are broken. Note the special @field for Scala case classes. Here's a sample:
case class Watcher(
@(JsonProperty@field)("guid")
@(RiakKey@field)
val guid: String,
@(JsonProperty@field)("socialNetwork")
val socialNetwork: String, // instragram, twitter
)
When I go to pull a Watcher serialized as JSON from the database, Jackson goes to deserialize it and it throws the exception:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "guid" (class com.domain.SocialStreamService.models.Watcher), not marked as ignorable (0 known properties: ])
Now since this was working in 1.9, I am assuming something has changed. Anyone know the cause of the issue? Thanks!
It was caused by a namespace issue and the fact that I was using Jerkson (which still pulled in 1.x as a dependency, thus not throwing compiler errors). To solve the issue, I had to go change the namespaces from com.codehaus to com.fasterxml.
In the meantime, there is a legacy introspector for those who need it: https://github.com/Laures/jackson-legacy-introspector
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With