简体   繁体   中英

Thymeleaf Array Element Join

My Array is as follows:

members_array = [{'nickname':'mike','age':'21'},{'nickname':'dan','age':'30'}]

Objective is to join the nickname elements of the array.

${#strings.arrayJoin(members_array ,',')}

Result:

{nickname=mike,age=21},{nickname=dan,age30}

When in fact what i really want is just

mike, dan

Any help would be appreciated. Thanks

Use Collection Projection for this.

${#strings.arrayJoin(members_array.![nickname], ',')}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM