JSON Connector

Version 20.0.7681


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 will automatically detect whether input files are JSON or XML and translate the file to the other format. The connector supports configurable syntax for distinguishing attributes and for 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.
  • Invalid XML Name Prefix When a JSON element has a name that would not be valid XML, this prefix is added to the XML element name. For example, a JSON element name can start with a number and an XML element name cannot; when translating from JSON to XML, the value of this field would be prepended to the element name to ensure the resulting XML is valid.
  • Minify output Whether to reduce the whitespace in the resulting XML or JSON document. Enabling this option conserves space but may make the output less human-readable.

Local Folders

Settings that determine where the connector will read files for processing and write out results.

  • Input Folder (Send) Files placed here can be processed into a REST request by the connector. If Send Automation is enabled, the connector will automatically poll this location for files.
  • Output Folder (Receive) Data downloaded by the connector will be written to this folder. If the connector is connected to another connector in the flow, files will not remain here and will instead be passed along to the Input/Send folder for the connected connector.
  • Processed Folder (Sent) The connector will place a copy of processed files here if Save to Sent Folder is enabled. This copy of the file will not be passed along to the next connector in the flow.

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.

Other Settings

Settings not included in the previous categories.

  • Log Messages Whether logs from processed files will include a copy of the file itself.
  • Save to Sent Folder Whether files processed by the connector should be copied to the Sent folder for the connector.

Automation

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

  • Send Whether messages arriving at the connector will automatically be processed.

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>