Skip to main content

Data structure

#itemContent​

Get the value of the content attribute from an ite with a specific key

Usage:

We have this input data:

{
"items": [
{
"key": "text1",
"content": "Hello World"
},
{
"key": "text2",
"content": "Second Value"
}
]
}

Template:

{{itemContent items "text1"}}

Result:

Hello World

Fallback example​

Template:

{{itemContent items "missingKey" "NOT FOUND"}}

Result:

NOT FOUND

If no fallback provided. The result will be empty string ""

Using Custom Property Names​

By default helper expect

PropertyDefault
key fieldkey
value fieldcontent

But you can customize both.

Data input:

{
"attributes": [
{
"name": "color",
"value": "red"
},
{
"name": "size",
"value": "XL"
}
]
}

Template:

{{itemContent attributes "color" keyProp="name" valueProp="value"}}

Result:

red