Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonUnwrapped doesn't work with Map #260

Closed
Keshi opened this issue May 21, 2016 · 1 comment
Closed

JsonUnwrapped doesn't work with Map #260

Keshi opened this issue May 21, 2016 · 1 comment

Comments

@Keshi
Copy link

Keshi commented May 21, 2016

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
}

@cowtowncoder
Copy link
Member

cowtowncoder commented Jun 28, 2016

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:

FasterXML/jackson-databind#171

There are no current plans to try to extend @JsonUnwrapped to work with Maps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants