Home Search

DriveWorks Pro 22
SppJsonToXml

Send Feedback

SppJsonToXml

Converts a JSON string to XML.

This function will only work with JSON strings that have a single root.

For example, the JSON below contains multiple root nodes and will not be accepted by this function;

{
"firstName": "John",
"lastName": "Smith",
"isActive": true,
"age": 27,
"address":

{ "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021-3100" }
,
"phoneNumbers": [
{ "type": "home", "number": "212 555-1234" }
,
{ "type": "office", "number": "646 555-4567" }
,

{ "type": "mobile", "number": "123 456-7890" }
],
"children": [],
"spouse": null
}
                    

Syntax

SppJSONToXml([JSON])

Where:

JSON is JSON data as text.

Example

RuleResultMeaning
SppJsonToXml(DWVariableLoadedJSON)
<?xml version="1.0" standalone="no"?><root><company id="1">
<name>Google</name><url>http://www.google.com</url>
</person><company id="2"><name>Yahoo</name>
<url>http://www.yahoo.com</url></person></root>
Converts the loaded JSON data to XML.

See also:

SppJSONEscape

SppJSONLoad

SppJSONUnEscape