XmlToJson

XmlToJson (ODC)

Stable version 0.1.3 (Compatible with ODC)
Uploaded on 11 October 2024 by OutSystems Labs
XmlToJson

XmlToJson (ODC)

Documentation
0.1.3

This library exposes a single method called ConvertXmlToJson.


ConvertXmlToJson

This method converts an XML document to the equivalent JSON.


Input parameters

  • XML: {Text; Mandatory} XML to be converted to JSON. It must be valid XML, or it cannot be parsed.
    Note that any namespaces are parsed as well and included in the JSON. Any attributes are included as well, with an "@" in front of the name.
  • ArrayNodes: {Node List; Not Mandatory} Optional list of the (local) node names that must be converted to a JSON array, even if there's only a single element in the XML.
    This helps with situations where you may sometimes have a single element and sometimes multiple elements. Without specifying the node to be treated as an array, the JSON will sometimes contain an object, sometimes an array of objects, which means you cannot convert the JSON to a structure easily.
    If specified, each node in the XML document that has a local name that is equal to one of the node names in the list will become an array in the output JSON.

Output parameters

  • JSON: {Text} The converted JSON.
    The resulting JSON can be used to create structures from (design time), or serialized (run time).