Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Coming Soon

...

hiddentrue
Excerpt
hiddentrue

jsonToItems (JSON, JSON Path, Lenient) Converts a block of JSON data into a recordset which contains the attributes for each node. 

...

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

...

Defaults to “$” which matches the entire document. This must be passed in as a string i.e. encapsulated in quotes.

...

Lenient is a flag which determines whether to parse the JSON String leniently. Defaults to false.

...

Examples

Record Set Returned

Code Block
jsonToItems('{"data":[{"value":"foo"},{"status":"bar"}]}', '$.data', true)

Returns

Code Block
// returns a record set
{"value" : "foo"}, {  "value" : "bar"}

Array Returned

Code Block
jsonToItems('{"data":[{"value":"foo"},{"status":"bar"}]}', '$.data', true).value

Returns

Code Block
// returns an array of values*
[foo, bar]

...

name given to the root element.

Example

Code Block
toXML(getCo, "CompaniesData")

Returns the XML:

Code Block
<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>


Expand
titlePretty Printed


Code Block
languagexml
linenumberstrue
<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