
# Output content as JSON

> Combine a skip-tag Template, a Format using SerializerTool.toJson inside a protect code section, and a JSON Output to publish content as a .json file.

URL: https://www.hannonhill.com/cascadecms/latest/articles/developing-in-cascade/script-formats/output-content-as-json.html
category: Developing in Cascade
article-type: how-to
content-kind: faq
release-availability: all
tags: velocity, json
updated: 2026-10-06

With a combination of Template, Format, and Output, you can publish page content as a JSON file.

## Template

Create a Template using skip tags and a "dummy" surrounding element:

```html
<!--#​cascade-skip--><pass-through><​system-region name="DEFAULT"/></pass-through>
```

## Format

Generate valid JSON and surround it with a `#​protect-top` [code section](https://www.hannonhill.com/cascadecms/latest/articles/developing-in-cascade/code-sections.html). In Velocity, [SerializerTool.toJson](https://www.hannonhill.com/cascadecms/latest/articles/developing-in-cascade/script-formats/velocity-tools.html#_SerializerTool_toJson) converts an XML string or JDOM Element to JSON.

```velocity
#set ($callingPage = $_XPathTool.selectSingleNode($contentRoot, "//calling-page/system-page"))
<!--#​protect-top
$_SerializerTool.toJson($callingPage, true)
#​protect-top-->
```

Or in XSLT:

```xml
<xsl:comment>#​protect-top
...JSON content here...
#​protect-top</xsl:comment>
```

## Output

Create a new Output in your page Configuration:

- **Type of Data** — JSON
- **File Extension** — .json
- **Template** — the Template you created above
- **Regions** — apply the Format you created and a calling page Index Block to the `DEFAULT` region

See [How do I create a "calling page" Index Block?](https://www.hannonhill.com/cascadecms/latest/articles/content-authoring/blocks/create-calling-page-index-block.html) if you don't have one yet.
