I’ve worked with struts for quite sometime now, but never figured the awesome “json” response type.
I have a large list of objects that I want to return to client. I use only a subset of these fields (typically ‘displayName’s) on the UI.
Is there a way to restrict the fields that are serialized as JSON back to the client?
One obvious approach I could think of is to create a view object which has subset of the fields. Please suggest the best practice here.
You can use exclude property of json plugin to exclude properties which you don’t want to serialize.
For more details refer to json-plugin