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

FEATURE:@JsonOnlyProperties / @JsonIncludeProperties needed #133

Closed
sunphy opened this issue Mar 30, 2018 · 4 comments
Closed

FEATURE:@JsonOnlyProperties / @JsonIncludeProperties needed #133

sunphy opened this issue Mar 30, 2018 · 4 comments

Comments

@sunphy
Copy link

sunphy commented Mar 30, 2018

Let's say you have 1 entity with cascade need to be serialized, when you only need serialize part of cascaded entity, you should do it as following:

class Organization{
    private int id;
    private String name;
    private String address;
    private String telehpone;
    private String website;
    ......
}
class Person{
    private int id;
    private String firstName;
    private String lastName;
    @JsonIgnoreProperties({"address","telephone","website"})
    private Organization organization;
}

but what if the ignored properties is too many and I only need the id and name properties to be serialized?A @JsonOnlyProperties or @JsonIncludeProperties is more convenient and very easy to use.
Think this scenario is most needed.

@cowtowncoder
Copy link
Member

I think this is already filed as:

FasterXML/jackson-databind#1296

and the reason it sort of belongs more in jackson-databind is just because adding annotation is simple, but adding actual handling and support is anything but (due to complexity of processing, at this point).

@sunphy
Copy link
Author

sunphy commented Apr 2, 2018

OK.Thank you.
I think this is very useful!

@cowtowncoder
Copy link
Member

Closing this in favor of the issue mentioned above.

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