Start page / Enhanced JSON support / JSON output of media

JSON output of media

It is also possible to hand over a medium to the JSON function. This creates a JSON object with all relevant information for the corresponding medium.
In this manner it is also possible to create a “media publication” which creates the JSON information for each medium in a JSON file and additionally writes the media itself into the file system.

Here is an example of a page template that generates all media in the project accordingly:

$CMS_SET(storeType, class("de.espirit.firstspirit.access.store.Store$Type"))$
$CMS_SET(mediaClass, class("de.espirit.firstspirit.access.store.mediastore.Media"))$
[
$CMS_FOR(file, #global.project.userService.getStore(storeType.MEDIASTORE, true).
children(mediaClass, true))$
$CMS_VALUE(json(file))$
$CMS_IF(!#for.isLast)$,$CMS_END_IF$
$CMS_END_FOR$
]

With this example, all media of the project are created and the corresponding information is written into a JSON document.

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