View JSON Data
The JSON data returned to every page and block can be viewed and accessed via a URL or template formatter.
Website & Collection Data
To access the data behind any collection in a structured format, append this query string to any URL on your site: ?format=json-pretty
In addition to returning collection data, other data needed to construct a full page (such as website data) will also be returned.
Note: Using
?format=json-prettyis not static and should not be used as an alternative to our APIs.
Pretty JSON Example:
Here is an example URL you can paste into your browser address bar to view the JSON data:
http://base-template.squarespace.com/blog/?format=json-pretty
Code
Block & Navigation Data
Within a template file directly, you can use the JSON formatter to output JSON for any item you have in scope, just add this within the block file: {item|json-pretty} – this is very useful during development as you can review the JSON data available in the source of the page as rendered.
Example from a navigation.block file:
Code
You can also log the object in your browser's console if you find that preferable to viewing the source:
Code
This is especially useful for debugging.