Skip to main content

Encode JSON

XML
<encode:json var="var" var_result="var" pretty="bool"/>

<encode:json /> generates the JavaScript Object Notation (JSON) representation of the value of a variable according to RFC 4627.

<encode:json /> is the complement of the <decode:json /> operation.

Attributes

NameTypeDescriptionDefined By
varvarVariable name encode:json
var_resultvarResult variable name encode:json
prettyboolPretty print encode:json

Results

BindingTypePredicate
var_resultstringN/A

Examples

XML
<array var="names">
<item key="bg">Bill Gates</item>
<item key="sj">Steve Jobs</item>
</array>

<output>
<encode:json var="names"/>
</output>

<!-- {"bg":"Bill Gates","sj":"Steve Jobs"} -->