XML to JSON
Use this action to convert the XML data to JSON format.
Using the XML to JSON Action
To use this action in your workflow, connect it to ThingWorx Flow. To connect to the flow, do the following:
1. Click , drag the XML to JSON action under the Transform utility to the canvas, place the pointer on the action, and then click or double-click the action. The XML to JSON action window opens.
2. Edit the label name, if needed. By default, the label name is same as the action name.
3. In the XML Data field, enter the XML data.
4. In the Attribute Key field, enter prefix that is used to access the attributes.
5. In the Ignore Attributes field, select one of the following options:
true—Ignores all XML attributes and only create text nodes.
false—Does not ignore all the XML attributes and does not create the text nodes.
6. In the Merge Attributes field, select one of the following options:
true—Merge attributes and child elements as properties of the parent, instead of keying attributes off a child attribute object.
false—Does not merge attributes and child elements as properties of the parent.
* 
This option is ignored if Ignore Attributes option is set to false.
7. In the Explicit Array field, select one of the following options:
true—Always puts child nodes in an array.
false—An array is created only if there is more than one array.
8. In the Normalize Tags field, select one of the following options:
true—Normalizes all tag names to lowercase.
false—Does not normalize all the tag names to lowercase.
9. In the Trim Whitespace field, select one of the following options:
true—Trims whitespaces inside the text nodes.
false—Does not trim the whitespaces inside text nodes.
10. In the Strip Namespace Prefix field, select one of the following options:
true—Strips the XML namespace prefix.
false—Does not strip the XML namespace prefix.
* 
The XMLNS prefix is not stripped.
11. In the Parse Numbers field, select one of the following options:
true—Parses integer-like strings as integers and float-like strings as floats.
false—Does not parse integer-like strings as integers and float-like strings as floats.
12. In the Parse Booleans field, select one of the following options:
true—Parses boolean-like strings to booleans.
false—Does not parse boolean-like strings to booleans.
13. In the Strict Parse field, select one of the following options:
true—Set sax-js to strict mode.
false—Set sax-js to non-strict mode.
14. Click Done.
Output Schema
The XML to JSON action returns an output schema as shown in the figure that follows:
Was this helpful?