findIn

Find in an array of objects or tags the object with the property which matches the value.

1
2
3
{{#findIn [array] property="" value=""}}
{{this}}
{{/findIn}}
Example
format JSON XML
Data JSON
1
2
3
4
5
6
7
{
"vegetables": [
{"name": "Tomato", "total": "5.20"},
{"name": "Cauliflower", "total": "6.40"},
{"name": "Carrot", "total": "3.10"}
]
}
Code
1
2
3
{{#findIn vegetables property="name" value="Cauliflower"}}
{{name}}: $ {{total}}
{{/findIn}}
Result
Data XML
1
2
3
4
5
<Vegetables>
<vegetable name="Tomato" total="5.20" />
<vegetable name="Cauliflower" total="6.40" />
<vegetable name="Carrot" total="3.10" />
</Vegetables>
HTML
1
2
3
{{#findIn Vegetables.vegetable property="_name" value="Cauliflower"}}
{{_name}}: $ {{_total}}
{{/findIn}}
Result