Introduction / FirstSpirit ServerManager / Support for JSON

JSON Support

JSON (JavaScript Object Notation, see https://json.org/) is a lightweight data-interchange format and the standard format for FirstSpirit CaaS et al.

Correctly configured, FirstSpirit supports template development for JSON output with a JSON validator. The following steps are required to use the validator:

Presentation channel (Server properties)

A system presentation channel for JSON is automatically made available on each FirstSpirit server. The new system channel is displayed in the Server Manager under Server properties / Presentation channels (see figure).

The system presentation channel for JSON uses the JSON validator for post-processing.

Important A system presentation channel cannot be edited or deleted.

Template set (Project properties)

To activate the presentation channel for JSON in your projects, a corresponding template set must be added in the project's properties (see figure).

It is recommended to disable the “Template Inspection” option.

In the respective template, JSON output is displayed on the JSON channel tab (if it was previously connected to a preview page from the structure, see Properties tab (→FirstSpirit Online Documentation)):

{ "headline": "First Page", "text": "my text" }

If you want the JSON output to be more human-readable, you can activate indentation and line breaks with:

 	$CMS_SET(#global.json.prettyPrinting, true)$

Syntax errors inside the JSON output will be flagged with a note on the corresponding position, e.g.

"hidden":false,"newRow":true,"text":"<h3"> <----- INVALID JSON: expected ',' or '}' - got '>'

As with most syntax checks, an error can trigger a series of alleged subsequent errors, which will be resolved by correcting the first error.

Calling "Display preview errors"

For more detailed information on the error, the context menu function Display preview errors can be called on the corresponding page under Contents or Structure for the JSON Channel (see Context menu - Special (→Documentation FirstSpirit SiteArchitect)).

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.4 | Data privacy