JSON Formatting
https://handlebars-test.proddev.terminalfour.net/terminalfour/page/section#edit/7810/contentsProgrammable layouts are often utilised to ensure content is safe to be used in JSON output.
A _jsonString _Custom Helper was created to make this process easier. If you'd like to see the underlying code from this Custom Helper [you can check out this doc on Confluence](https://confluence.terminalfour.com/display/PM/Custom+Helper%3A+Escape+JSON).
How it's used:
`{{ jsonString (thing-to-be-escaped) }}`
## Example
```
{
"Plain text": "{{jsonString (publish element="Text element") }}",
"HTML": "{{jsonString (publish element="HTML element") }}",
"Media": "{{jsonString (publish element="Media element") }}",
"List": "{{jsonString (outputSelected(selected element="Checkbox")) }}"
}
```
{
"Plain text": "This is a text element that contains \"some\" quotes",
"HTML": "<p>This is a html element.<\/p>\n<p>There are <span class=\"example\">quotes<\/span> in here too.<\/p>",
"Media": "<img loading=\"lazy\" src=\"\/media\/sample-site\/site-assets\/css\/css-images\/t4u-logo-header.png\" alt=\"\" class=\"\" \/>",
"List": "Name with \"quotes\", Other"
}
UG Quicklinks
Quicklinks
PG Quicklinks