Start page / Enhanced JSON support / Configuration

Configuration

Contents

The JSON output can be configured using the #global.json system object.

formatVersion

$CMS_SET(#global.json.formatVersion, "1.1")$

The format version to be used is set to the specified value. A format version defines the structure and attributes of the JSON that will be generated. If a non-modified JSON output is needed even after FirstSpirit updates have been performed, the format version should be set explicitly in the project settings, under “Global Settings” (see Project Settings (→Documentation FirstSpirit SiteArchitect)).

If the format version is not set explicitly, the latest JSON format version will always be used. If an unsupported format version is defined, this will result in an error.

prettyPrinting

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

Switches PrettyPrinting on or off (default), if the JSON validator is used for the JSON template set.

If the value is set to “false”, no spaces are used, making this the best option for data transfer.

If the value is set to “true”, the output becomes more legible to humans, since indentations and different spaces are used for the JSON output.

This setting can also be used with JSON that was not generated with the json() function.

Important PrettyPrinting is only supported if the JSON validator is used for the JSON output.

sectionTemplateRendering

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

Switches template rendering for section elements on or off (default).

If the value is set to “true”, the template of every section is evaluated and the result of the template is the JSON output.

If the value is set to “false”, the content of the sections is output automatically together with the content of the page. The individual section templates are not evaluated.

metaDataRendering

$CMS_SET(#global.json.metaDataRendering, false)$

Switches the output of FirstSpirit metadata on (default) or off.

If the value is set to “true”, the metadata for every page is output as a separate JSON object.

If no metadata is set, an empty element is output.

dataRenderDepth

$CMS_SET(#global.json.dataRenderDepth, 1)$

Defines how many levels are to be output with datasets. A whole number value must be transferred.

Value < 1: Only a reference to the dataset is output.

Value = 1: The dataset is output and linked datasets are output as a reference (default).

Value >= 2: The corresponding number of foreign key relationships are maintained and the referenced datasets are output too.
Please note here that the last level is only output as a reference to the corresponding dataset; for higher levels, the content of the corresponding datasets is output as well.

Example of a corresponding reference:

value": { 
"fsType": "DatasetReference",
"target": {
"fsType": "Dataset",
"schema": "Referenzketten",
"entityType": "Target1",
"identifier": "b9aa57bd-9561-4667-ac7c-3b98510c9e57",
}
}

nonDisplayedSectionsRendering

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

Switches the output of hidden sections on or off (default).

If the value is set to “true”, hidden sections will also be output. In addition, a “displayed” attribute is then created for each section, in which the language-dependent setting regarding the output is mapped.

If the value is set to “false”, then hidden sections will not be “displayed”. The displayed attribute is then not created.

© 2005 - 2021 e-Spirit AG | All rights reserved. | FirstSpirit 2021-02 | Data privacy | Imprint | Contact us