我有像以下的數組:Freemarker的:找到在對象的陣列的一個結果
<#assign services = [
{'id': '1', 'name': 'AAAA'},
{'id': '22', 'name': 'BBBB'}
]>
我知道ID ..示例。我需要的是這樣的:
${services[2].name} // print BBBB
我想這,但沒有結果
${services[services.type?seq_index_of(22)].name}
有沒有辦法做到這一點?
謝謝大家幫忙
謝謝...宏是個好主意,我喜歡它......我在freemarker中 – daremachine