You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case class MapWrapper(@(JsonUnwrapped @field @getter @beanGetter) val x:Map[Int,Int])
object JsonMapper extends ObjectMapper with ScalaObjectMapper {
registerModule(DefaultScalaModule)
}
JsonMapper.writeValueAsString(MapWrapper(Map(1->2)))
res1: String =
{
"x" : {
"1" : 2
}
}
Whereas,
case class Inner(x:Int)
case class Wrapper(@(JsonUnwrapped @field @getter @beanGetter) y:Inner)
JsonMapper.writeValueAsString(Wrapper(Inner(1)))
res3: String =
{
"x" : 1
}
The text was updated successfully, but these errors were encountered:
Functionality for unwrapping is implemented by jackson-databind, not Scala module. But this feature only works for POJOs (and Scala equivalents), not Maps or JsonNodes.
So I think this is same as:
Whereas,
The text was updated successfully, but these errors were encountered: