Start page / Enhanced JSON support / Configuration

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: rendering metadata (default setting: true)

The JSON rendering of metadata can be activated or deactivated with the $CMS_SET(#global.json.metaDataRendering, <BOOLEAN>)$ switch (default setting: true).

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

With the $CMS_SET(#global.json.metaDataRendering, true)$ setting (default setting), metadata for all objects is rendered. If no metadata is set, an empty element will be rendered.

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

With the $CMS_SET(#global.json.metaDataRendering, false)$ setting, the JSON rendering of metadata is explicitly switched off.

metaInheritanceRendering: rendering inherited metadata (default setting: false)

The JSON rendering of inherited metadata can be activated or deactivated with the $CMS_SET(#global.json.metaInheritanceRendering, <BOOLEAN>)$ switch (default setting: false).

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

In the default setting $CMS_SET(#global.json.metaInheritanceRendering, false)$, only metadata that was defined on the object itself will be rendered. If no metadata is defined on the object, an empty value is rendered via the metaFormData attribute, even if the object has inherited metadata.

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

In the $CMS_SET(#global.json.metaInheritanceRendering, true)$ setting, the metadata that is rendered was not defined on the FirstSpirit object itself but on a hierarchically superordinate object. The inherited metadata is transferred to a JSON object structure. The values of the next higher object that are valid at that time, for which the corresponding metadata was defined, are thereby used (up to the root node of the store).

Important Changes to a pass-on node will not cause the inheriting nodes to be seen as changed. If the inheritance of the metadata is activated, a suitable mechanism must ensure that the data is updated accordingly.

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.

outputLengthLimit

Sets a size limit for the generated JSON file in bytes (default value: unlimited).

Example: size limit at 15MB

$CMS_SET(#global.json.outputLengthLimit, 15728640)$

If the set value is exceeded, the JSON file creation will be aborted. An ERROR message will be displayed.

Important If a size limit is set and this causes the JSON file creation to abort, the resulting file wil be invalid.

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