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

serialize plain object to multi-level json (@JsonWrap[ped]) #28

Open
skyding228 opened this issue Jul 23, 2018 · 2 comments
Open

serialize plain object to multi-level json (@JsonWrap[ped]) #28

skyding228 opened this issue Jul 23, 2018 · 2 comments

Comments

@skyding228
Copy link

public class Member{
    private String id;
    @JsonProperty("User.name")
    private String name;
    @JsonProperty("User.age")
    private Integer age;
}

I expect the serialization is

{
  "id":null,
   "User":{
        "name":null,
        "age": null
   }
}
@cowtowncoder
Copy link
Member

I don't think I agree with magical use of dots in names (since they are legal name characters in general). But there is a suggestion for something like @JsonWrapped, and for such use it (or maybe more likely, use of String arrays in annotation), things could work.
Challenge is mostly wrt implementation as no tree structure is currently held in memory: serialization can be easy (... except, when multiple properties try to use same wrapping...), but deserialization becomes complex when wrappers need to be removed.

@cowtowncoder cowtowncoder changed the title serialize plain object to multi-level json serialize plain object to multi-level json (@JsonWrap[ped]) Dec 16, 2018
@simon04
Copy link

simon04 commented May 14, 2020

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

3 participants