json-view icon indicating copy to clipboard operation
json-view copied to clipboard

Better Support for JsonIgnore and XmlTransient

Open stevenhurth opened this issue 9 years ago • 1 comments

Man, I must say, what you've produced here is great! I was able to wire this into an API I've been working on, and intercept every request to allow end users to pass in which fields they would like back. After all said and done, there was no need to hand code anything with the JsonView within any controllers.

One thing that I noticed (which is actually a feature of JsonView) is that including all fields (using an asterisk) actually serializes XmlTransient and JsonIgnore attributes back in the response. However, this can be very problematic when comparing JSON results with generated Swagger docs, and/or extending third party framework objects such as Spring's ResourceSupport for HATEOAS.

What would be great is if we had the capability to disable this feature using the JsonResult. So, we'd return all fields, but not those that were marked to be ignored.

stevenhurth avatar Sep 28 '16 19:09 stevenhurth

There is another situation that needs the support of @JsonIgnore: If I have a complex object, and a circular dependency occurs inside it, I use @JsonIgnore in Jackson to solve the problem of circular dependency, but if I use Json-view, then The problem of circular dependency may occur again.

theten52 avatar Nov 17 '21 02:11 theten52