>-----Original Message-----
>From: Micael Carreira <mcarre...@itclinical.com>
>Sent: Tuesday, September 24, 2019 1:30 PM
>To: user@struts.apache.org
>Subject: JSON plugin: filter fields in a Map with Lists
>
>Hello,
>
>In MyAction, I have the following instance variable:
>
>     Map<String, List<MyObject>> result;
>
>And MyObject has the following properties:
>
>     MyObject
>     |- interestingProperty
>     |- notInterestingProperty
>
>I want to return the action result as a JSON. So, in my struts configuration I 
>have:
>
>     <action name="MyAction" method="execute" class="myAction">
>         <result name="success" type="json">
>             <param name="includeProperties">
>                 result\..+$
>             </param>
>         </result>
>     </action>
>
>This returns all keys/values in result map. But I want to write a JSON with 
>only
>interestingProperty of each MyObject (which are in a list).

Hi,

Doesn't below work for you (to write only interestingProperty)?

<param name="includeProperties">
result,interestingProperty
</param>

Regards.

>
>I've fiddled with the regular expression for a while, but could not find a way 
>to do
>it.
>
>Is it possible to achieve what I need?
>
>Thanks,
>
>--
>Email Signature
>Micael Carreira
>Software Developer     Logo
><https://www.itclinical.com&utm_source=mail&utm_medium=banner&utm_cam
>paign=signature>
>
>Rua Augusto Macedo, 12-B
>1600-794 Lisbon - Portugal
>t: +351 21 714 4500
>www.itclinical.com
><http://www.itclinical.com&utm_source=mail&utm_medium=banner&utm_cam
>paign=signature>
>       Facebook icon <https://www.facebook.com/ITClinical> LinkedIn icon
><https://www.linkedin.com/company/itclinical>
>The content of this email is confidential and intended for the recipient 
>specified in
>message only. It is strictly forbidden to share any part of this message with 
>any
>third party, without a written consent of the sender. If you received this 
>message
>by mistake, please reply to this message and follow with its deletion, so that 
>we
>can ensure such a mistake does not occur in the future.

Reply via email to