XMLToJSON

This Activity takes stringified XML data as input and converts it into a JSON object, which can then be accessed by the downstream activities that follow.

XMLtoJSON Conversion limitations

The differences between XML and JSON impose some of the below limitations.

  • The XML element and attribute names should not contain any delimiter used in JSON

  • XML comments (<!-- comment -->) are ignored in the JSON document

  • DTD declarations are ignored.

  • XML processing instructions are ignored.

  • All XML element/attribute values are transformed to a JSON string as the conversion is not schema (xsd) aware. Set typecast to true to convert string data starting with number to integer and string data starting with true/false to boolean. Set ordered field as true to set the key in alphabetical order in JSON.

  • Entity references are ignored.

  • XML attribute then while converting to json, hyphen ( - ) used as a prefix in json to indicate attribute and # indicate key.

Input

Field Description
xmlString This field takes stringified XML data. We can directly pass stringified xml data manually or map the textContent coming from previous activity (e.g. GET XML file from S3).
Ordered This field takes boolean value. When set ordered to true, set key in JSON in alphabetical order.
typeCast This flag controls the conversion of string data. When enabled (True): String data starting with a number is converted to an integer. String data starting with "true" or "false" is converted to a boolean.

Output Settings

Field Description
Schema Configure expected object structure using JSON schema or JSON sample.

Output

Display output as read-only xmlString.