/
toXML

toXML

Function: toXML()

Converts an object or JSON string to XML.  

Syntax

toXML(input, root)

ArgumentTypeDescription
input

Object

JSON String

The object or JSON string to be converted to XML.
rootStringThe name given to the root element.

Example

toXML(getCo, "CompaniesData")

Returns the XML:

<CompaniesData><CompaniesData><CompanyID>102</CompanyID><CompanyName>Lockman, Barrows and Kessler</CompanyName><Industry>Telecoms</Industry></CompaniesData><CompaniesData><CompanyID>103</CompanyID><CompanyName>Boyle, Bogan and Mohr</CompanyName><Industry>Telecoms</Industry></CompaniesData><CompaniesData><CompanyID>104</CompanyID><CompanyName>Kassulke LLC</CompanyName><Industry>Telecoms</Industry></CompaniesData></CompaniesData>
 Pretty Printed
<CompaniesData>
    <CompaniesData>
        <CompanyID>102</CompanyID>
        <CompanyName>Lockman, Barrows and Kessler</CompanyName>
        <Industry>Telecoms</Industry>
    </CompaniesData>
    <CompaniesData>
        <CompanyID>103</CompanyID>
        <CompanyName>Boyle, Bogan and Mohr</CompanyName>
        <Industry>Telecoms</Industry>
    </CompaniesData>
    <CompaniesData>
        <CompanyID>104</CompanyID>
        <CompanyName>Kassulke LLC</CompanyName>
        <Industry>Telecoms</Industry>
    </CompaniesData>
</CompaniesData>

See Also

Related content

XML Namespace
XML Namespace
Read with this
jsonToXML
jsonToXML
More like this
Release Notes
Release Notes
Read with this
jsonToXML
jsonToXML
More like this
jsonToXML
jsonToXML
More like this
jsonToXML
jsonToXML
More like this