-
Notifications
You must be signed in to change notification settings - Fork 0
rife.render.EncodeJson
Erik C. Thauvin edited this page Mar 28, 2023
·
3 revisions
Encodes a template value to JSON.
<!--v render:rife.render.EncodeJson:valueId/-->
{{v render:rife.render.EncodeJson:valueId/}}
Template
{
"sample": "{{v render:rife.render.EncodeJson:sample/}}"
}
Code
template.setAttribute("sample", "This is a \"•test\"");
Output
{
"sample": "This is a \"\u2022test\""
}
By default, the rendered data is raw, not template encoded. If you need additional encoding, use the encoding
property.
For example, to encode the rendered data to HTML:
{{v render:rife.render.EncodeJson:valueId}}
encoding=html
{{/v}}
The supported additional encoding types are:
html
js
json
unicode
url
xml