with

Set the context position in the data to access other nodes.

1
2
3
{{#with [object|array]}}
{{this}}
{{/each}}
Example
format JSON XML
Data JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"brand":{
"palette": {
"logo":{
"light": {
"color": "white"
},
"dark": {
"color": "black"
}
}
}
}
}
Code
1
2
3
4
{{#with brand.palette.logo}}
<div>Light: {{light.color}}</div>
<div>Dark: {{dark.color}}</div>
{{/with}}
Result
Data XML
1
2
3
4
5
6
7
8
<brand>
<palette>
<logo>
<light name="white" />
<dark name="black" />
</logo>
</palette>
</brand>
HTML
1
2
3
4
{{#with brand.palette.logo}}
<div>Light: {{light._.color}}</div>
<div>Dark: {{dark._.color}}</div>
{{/with}}
Result