Start page / Enhanced JSON support / User-defined JSON outputs

User-defined JSON outputs

FirstSpirit JSON support for writing JSON templates

The complete output of FirstSpirit elements (up to complete pages) with $CMS_VALUE(json(#this))$ covers most use cases. But FirstSpirit JSON support can also be helpful in special cases where this output is not used.

For example, only the contents of an input component can be output by writing the name of the input component directly into the JSON channel.

For example, a text input component named “st_text” can be rendered as follows by writing $CMS_VALUE(json(st_text))$ into the JSON channel of the template: "Text input".

Example of a section with DOM editor

Beside the complete output of the section with the input component and the corresponding contents by
$CMS_VALUE(json(#this))$
this example shows that only the content of the DOM editor can be output by using
$CMS_VALUE(json(st_input_dom))$.

Output the complete section with

$CMS_VALUE(json(#this))$

Result:

{
"fsType": "Section",
"name": "dom_absatz",
"displayName": "DOM_Absatz",
"identifier": "70accc61-44a1-4a2f-b2d7-2e82e40e630e",
"template": {
"fsType": "SectionTemplate",
"name": "DOM_Absatz",
"displayName": "DOM_Absatz",
"identifier": "fbb787ba-bbb6-4172-84cd-276ab0d4d4a9",
"uid": "text_absatz_1",
"uidType": "TEMPLATESTORE"
},
"formData": {
"st_input_dom": {
"fsType": "CMS_INPUT_DOM",
"name": "st_input_dom",
"value": "<p>Inhalt eines DOM-Editors mit einem
<a href=\"www.e-spirit.com\">Verweis</a>.</p>"
}
}
}

Only the content of the DOM editor is output with

CMS_VALUE(json(st_input_dom))$ 

Result:

"<p>Contents of a DOM editor with a 
<a href=\"www.e-spirit.com\">Link</a>.</p>"

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