Key Capabilities
- Bidirectional JSON to XML conversion with automatic format detection
- Minimal configuration required (the connector typically works with the default configurations)
- Configurable attribute prefixes and text property handling for accurate translations
- Custom formatting options including minification and root element naming
- Type conversion support with JSON type annotations for precise data handling
Overview
The JSON connector enables conversion between JSON and XML without requiring much configuration. The connector automatically detects whether input files are JSON or XML, and then the connector translates the file to the other format. The connector supports configurable syntax for distinguishing attributes and ensuring that the output is valid XML or JSON.Connector Settings
This section contains all of the configurable connector properties.Settings Tab
Connector Settings
Settings related to the core operation of the connector.| Setting | Description |
|---|---|
| Connector Id | The static, unique identifier for the connector. |
| Connector Type | Displays the connector name and a description of what it does. |
| Connector Description | An optional field to provide a free-form description of the connector and its role in the flow. |
| Root Element Name | When converting from JSON to XML, this value is used as the name of the root element in the resulting XML document. This ensures that the output XML has a single root element regardless of the structure of the input JSON. |
| Attribute Prefix | The prefix is used to identify attributes in JSON. When converting from JSON to XML, the connector interprets values with this prefix as attributes in the resulting XML. When converting from XML to JSON, the connector adds this prefix to attribute values in the resulting JSON. See the Examples section for more information. |
| Text Property Name | When a JSON object has attribute values and a non-attribute value, this name identifies the non-attribute value. When converting from JSON to XML, values associated with this name are set in the text of the resulting XML element. When converting from XML to JSON, the text in the element is set as the value for this name. See the Examples section for more information. |
| Minify | When enabled, this option instructs the connector to reduce the whitespace in the resulting XML or JSON document. This option conserves space, but it can make the output more difficult for humans to read. |
Other Settings
| Setting | Description |
|---|---|
| Invalid XML Name Prefix | When a JSON element has a name that would not be valid XML, the connector adds this prefix to the beginning of the XML element name. For example, a JSON element named 10price must be modified to translate it to XML. Although a JSON element name can start with a number, XML element names cannot. If you set this field to num, the 10price JSON element becomes num10price in the XML output. |
| Local File Scheme | A scheme for assigning filenames to messages that are output by the connector. You can use macros in your filenames dynamically to include information such as identifiers and timestamps. For more information, see Macros. |
Advanced Tab
Logging
Other Settings
| Setting | Description |
|---|---|
| Processing Delay | The amount of time (in seconds) by which the processing of files placed in the Transactions tab is delayed. This is a legacy setting. Best practice is to use a File connector to manage local file systems instead of this setting. |
Miscellaneous
Automation Tab
Automation Settings
Settings related to the automatic processing of files by the connector.| Setting | Description |
|---|---|
| Send | A toggle that instructs the connector to automatically send files when they are ready. |
Performance
Alerts Tab
SLAs Tab
Macros
Examples
Conversion Examples
Examples of converting between XML and JSON with the JSON connector are below.XML to JSON
XML input:JSON to XML
JSON input:JSON Type Conversions
When converting from XML to JSON, the connector treats all XML elements as strings except in two cases:- If the connector detects multiple elements or values in the same XML structure in the XML input, it treats them as an array.
- If you apply an XML attribute to specify the JSON output format, this attribute overrides the default string behavior. These attributes are listed in the table below.
| Attribute | Description |
|---|---|
| json:array=“true” | If you have a single-element array, you can apply this attribute to ensure that the connector treats it as an array instead of a string. |
| json:type=“number” | Instructs the connector to treat the XML element as a number. |
| json:type=“boolean” | Instructs the connector to treat the XML element as a boolean. |
| json:type=“object” | Instructs the connector to treat the XML element as an object. |
| json:type=“null” | The connector treats empty XML elements as strings of length zero. This command forces the output to be null instead of an empty string. |
| xsi:nil=“true” | Same functionality as json:type=“null”. |