Form data connectors can output directly into XML or JSON format with the use of a text file template. Like any other template, this text file will contain data name placeholders placed inside either XML or JSON syntax.
The connector must be set to send data as a Text File in the associated drop-down property. Then a data template can be added under "Format Data With Template," accessible by clicking "ADD DATA TEMPLATE" in the top-right of the connector. The Attachment Name property should also be adjusted to specifically rename the file as either .xml or .json.
This does not work using export, but only works using a connector, such as email, Google Drive, or FTP.
The text file used as the template should be formatted as either XML or JSON. No validation will be performed to ensure proper formatting of either, so we recommend validating the file for proper syntax outside the dashboard before attaching it here.
Within the template, data names can be referenced for population. Any repeat tables or repeat pages, REPEAT syntax, {{!REPEATSTART}} can be placed at the end of the line before the repeating content begins and a REPEAT End syntax, {{!REPEATEND}} at the end of the repeat portion. This is applicable for hide sections if needed using {{!HIDEIFSTART({{jobNo}} = ‘Job’)}} and {{!HIDEIFEND}}. Please see below for examples of both.
XML template:
XML
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>{{name}}</to>
<from>{{connectorName}}</from>
<heading>{{Q1}}</heading>
<body>{{message}}</body>{{!REPEATSTART}}
<date>{{date}}</date>
<table1>{{table1}}</table1>
<table2>{{table2}}</table2>{{!REPEATEND}}
</note>
The resulting output:
XML
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Recipient</to>
<from>Sender</from>
<heading>Subject here</heading>
<body>Test here</body>
<date>04-09-2021</date>
<table1>Alpha</table1>
<table2>Beta</table2>
<date>04-09-2021</date>
<table1>Gamma</table1>
<table2>Delta</table2>
</note>
JSON template:
JavaScript
{ "text": {
"to": "{{name}}",
"from": "{{connectorName}}",
"heading": "{{Q1}}",
"body": "{{message}}",
}{{!REPEATSTART}}
{
"Date": "{{obstime1}}"
"Table 1": "{{table1}}"
"Table 2": "{{table2}}"
}{{!REPEATEND}}
}
The resulting output:
JavaScript
{ "text": {
"to": "Recipient",
"from": "Sender",
"heading": "Subject here",
"body": "Content here",
}
{
"Date": "04-09-2021"
"Table 1": "Alpha"
"Table 2": "Beta"
}
{
"Date": "04-10-2021"
"Table 1": "Gamma"
"Table 2": "Delta"
}
}