JSON Connector

Version 22.0.8473


JSON Connector


JSON Connectors support converting XML data into JSON and JSON data into XML.

Overview

JSON Connectors convert between JSON and XML with minimal configuration required. 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/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.

  • Connector Id The static name of the connector. All connector-specific files are held in a folder by the same name within the Data Directory.
  • Connector Description An optional field to provide 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 used to identify attributes in JSON. When converting from JSON to XML, the connector will interpret values with this prefix as attributes in the resulting XML. When converting from XML to JSON, the connector will add this prefix to attribute values in the resulting JSON. Please 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. Please see the Examples section for more information.
  • Minify output When enabled, this option instructs the connector to reduce the whitespace in the resulting XML or JSON document. This option conserves space, but it may make the output more difficult for humans to read.

Other Settings

  • 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, if you have a JSON element named 10price, this element name must be modified to translate it to XML. This is because a JSON element name can start with a number, but an XML element name cannot. If you set this field to num, the 10price JSON element becomes num10price in the XML output.
  • Processing Delay The amount of time (in seconds) that the connector will wait to process files in the Input folder.

Message

Settings that determine how the connector will search for messages and handle them after processing.

  • Save to Sent Folder A toggle that instructs the connector to keep a copy of sent messages in the Sent folder.
  • Sent Folder Scheme Instructs the connector to group files in the Sent folder according to the selected interval. For example, the Weekly option instructs the connector to create a new subfolder each week and store all sent files for the week in that folder. The blank setting tells the connector to save all files directly in the Sent folder. For connectors that process many transactions, using subfolders can help keep files organized and improve performance.

Logging

Settings that govern the creation and storage of logs.

  • Log Level Specifies the type of information to log in the connector’s Logs directory:
    • None — Does not create any logs.
    • Error — Creates logs only when the connector encounters an error.
    • Warning — Creates logs only when the connector issues a warning.
    • Info — Logs general information about the workflow, including any errors and warnings (if applicable).
    • Debug — Logs detailed debugging information for both successful and failed workflows.
    • Trace — Logs detailed trace information for both successful and failed workflows.

    Please note that Debug and Trace may log sensitive information including message contents and SSL certificates. Although connection properties (such as passwords) are masked, please review logs of this level for sensitive information before sharing them outside of your organization.

  • Log Subfolder Scheme Instructs the connector to group files in the Logs folder according to the selected interval. For example, the Weekly option instructs the connector to create a new subfolder each week and store all logs for the week in that folder. The blank setting tells the connector to save all logs directly in the Logs folder. For connectors that process many transactions, using subfolders can help keep logs organized and improve performance.
  • Log Messages A toggle that instructs the connector to save a copy of the most recent message in the Logs directory. Note that the connector only keeps one message per subfolder, and the connector overrides the previously-saved message when it runs again.

Miscellaneous

Settings for specific use cases.

  • Other Settings Allows configuration of hidden connector settings in a semicolon-separated list, like setting1=value1;setting2=value2. Normal connector use cases and functionality should not require use of these settings.

Automation Tab

Automation Settings

Settings related to the automatic processing of files by the connector.

  • Send A toggle that instructs the connector to automatically send files when they are ready.

Performance

Settings related to the allocation of resources to the connector.

  • Max Workers The maximum number of worker threads that will be consumed from the threadpool to process files on this connector. If set, overrides the default setting from the Profile tab.
  • Max Files The maximum number of files that will be processed by the connector each time worker threads are assigned to the connector. If set, overrides the default setting from the Profile tab.

Examples

Below are examples of converting between XML and JSON with the JSON Connector.

XML to JSON

XML input:

<Fable>
  <Author alive="false">Aesop</Author>
  <Title>Tortoise and the Hare</Title>
  <Characters>
    <Character id="1" slow="true">Tortoise</Character>
    <Character id="2" slow="hardly">Hare</Character>
  </Characters>
  <Moral>Persistence over speed</Moral>
</Fable>

JSON output:

{
  "Fable": {
    "Author": {
      "@alive":"false",
      "#text":"Aesop"
    },
    "Title":"Tortoise and the Hare",
    "Characters": {
      "Character": [
        {
          "@id":"1",
          "@slow":"true",
          "#text":"Tortoise"
        },
        {
          "@id":"2",
          "@slow":"hardly",
          "#text":"Hare"
        }
      ]
    },
    "Moral":"Persistence over speed"
    }
}

JSON to XML

JSON input:

{ 
  "Catch": [
    {
      "type": "salmon",
      "quantity": "2",
      "weight": "20.2 lbs"
    },
    {
      "type": "pike",
      "quantity": "21",
      "weight": "521 lbs"
    }
  ],
  "Lake": "Boulder",
  "Weather": "Clear",
  "808s": "Loud" 
}

XML output:

<Items>
  <Catch>
    <type>salmon</type>
    <quantity>2</quantity>
    <weight>20.2 lbs</weight>
  </Catch>
  <Catch>
    <type>pike</type>
    <quantity>21</quantity>
    <weight>521 lbs</weight>
  </Catch>
  <Lake>Boulder</Lake>
  <Weather>Clear</Weather>
  <_808s>Loud</_808s>
</Items>

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 within 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.
  • 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”.