Hello Community,
I have a CaaS architecture, and the template has a html and CaaS code that is in JSON first spirit syntax.
I need to read that json file, convert it the html, and afterwards I will create input components that correspond to the given content (e.g. images, text, headlines, etc.).
Here is the code example of the CaaS :
$CMS_TRIM(level:4)$
$CMS_SET(set_JSON_use_stack_old,set_JSON_use_stack)$
$CMS_SET(set_JSON_use_stack, true)$
$CMS_SET(set_JSON, {:})$
$CMS_SET(void, set_JSON.put("className", "ucp-ekomi-widget"))$
$CMS_SET(void, set_JSON.put("key", "01_11b"))$
$CMS_SET(void, set_JSON.put("element", {:}))$
$CMS_IF(!#global.page.store.isRelease())$
$CMS_SET(void, set_JSON.get("element").put("previewId", previewId().toString()))$
$CMS_END_IF$
$CMS_SET(void, set_JSON.get("element").put("sectionId", #global.section.id.toString()))$
$CMS_SET(void, set_JSON.get("element").put("ekomiId", if(!st_ekomi_id.isEmpty(), st_ekomi_id, "")))$
$CMS_SET(set_JSON_use_stack, set_JSON_use_stack_old)$
$CMS_IF(isSet(set_JSON_use_stack) && set_JSON_use_stack)$
$CMS_SET(void, set_JSON_stack.add(set_JSON_stack.size(), set_JSON))$
$CMS_ELSE$
$CMS_VALUE(set_JSON.toJSON)$
$CMS_END_IF$
$CMS_END_TRIM$
And this is corresponding html code in the same template :
<div class="ekomi-wrapper grey-background" $CMS_VALUE(editorId())$ id="$CMS_VALUE(#global.section.id)$">
$CMS_IF(!st_ekomi_id.isEmpty())$
<div id="eKomiWidget_default" data-cert="$CMS_VALUE(st_ekomi_id,default:"")$">
<!-- Content will be loaded here -->
</div>
$CMS_END_IF$
</div>
So my question is how can I read this json file, that queries content from database and then convert the content in to plain html, and afterwards create a corresponding first spirit input components so that content creator can change content.
Kind regards,
Aleksandar