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
| Name | Type | Description | Defined By |
|---|---|---|---|
| var | var | Variable name | encode:json |
| var_result | var | Result variable name | encode:json |
| pretty | bool | Pretty print | encode:json |
Results
| Binding | Type | Predicate |
|---|---|---|
| var_result | string | N/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"} -->