stringToObject

Convert a string value in an object.

1
2
3
{{#stringToObject [value] valueDelimiter="|" key="auto"}}
{{this}}
{{/stringToObject}}
Example
format JSON XML
Data JSON
1
2
3
4
5
{
"Colors": {
"names": "red|green|blue"
}
}
Code
1
2
3
{{#stringToObject Colors.names valueDelimiter="|" key="auto"}}
<div>{{_0}} - {{_2}}</div>
{{/stringToObject}}
Result
Data JSON
1
2
3
4
5
{
"Colors": {
"names": "r|red|g|green|b|blue"
}
}
Code
1
2
3
{{#stringToObject Colors.names valueDelimiter="|" key="key-value"}}
<div>{{r}} - {{b}}</div>
{{/stringToObject}}
Result
Data XML
1
2
3
<Colors
names="red|green|blue"
/>
HTML
1
2
3
{{#stringToObject Colors._names valueDelimiter="|" key="auto"}}
<div>{{_0}} - {{_2}}</div>
{{/stringToObject}}
Result
Data XML
1
2
3
<Colors
names="r|red|g|green|b|blue"
/>
HTML
1
2
3
{{#stringToObject Colors._names valueDelimiter="|" key="key-value"}}
<div>{{r}} - {{b}}</div>
{{/stringToObject}}
Result

Options

keyauto
key-value