JSON to XML
You need to convert one or more JSON files to a XML format.
Json
Example
json
{
"name": "file-conversion-json-to-xml",
"taskReferenceName": "json_to_xml",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"mode": "FILE",
"file": "${previous_TaskReferenceName.output.file}"
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Definition
Property | Type | Required | Description |
---|---|---|---|
The name (or type) of the task | |||
The unique name of the task in your job. It is used to reference this task in the workflow. | |||
The functional description of this task in your job. | |||
The type of the task. It must be SUB_WORKFLOW . | |||
true : the job continues if there is an error on this task. false : the job fails. | |||
Input parameters of the task. See below |
Inputs
Property | Description |
---|---|
mode | Enum FILE | FILES | REQUEST | JSON |
file | A valid input. It can reference the output of a previous task, example: ${previous_taskReferenceName.output.file} , or a static file, example: file://assets/file.csv , or a user input, example: ${workflow.input.input_key} . |
files | A valid input. It can reference the output of a previous task, example: ${previous_taskReferenceName.output.files} , or a user input, example: ${workflow.input.input_key} . |
request | A valid input. A file that defines which files must be recovered. See the definition below. |
json | - A valide JSON to be processed. |
Input request
Example
xml
<Json-To-Xml>
<File>
<Url>https://prodstoragevazc.blob.core.windows.net/images/ee0c68febf0afr3c76b2643bff3cc215030f0caf.json</Url>
</File>
<File>
<Url>https://prodstoragevazc.blob.core.windows.net/images/7a59ez747dbc536e53eebr7760b5145ge02b5bc25.json</Url>
</File>
</Json-To-Xml>
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Definition
Usually you need this after listing all files on sFTP with the FTP List task, and after having done the filtering of the file that must be retrieved in an Transform XSLT task. Use this method only if the other methods does not fit with your needs.
XPath | Description | Occurs |
---|---|---|
Json-To-Xml | Root of the document | 1 |
./File | For each file. | 0..* |
./File/Url | The url of the file | 1 |
Outputs
Property | Type | Description |
---|---|---|
file | An XML file as described below. | |
allFilesTransformed | YES | NO . YES : all files have been transformed successfully. NO : at least one file has not been transformed. |
Output file
Example
xml
<Json-To-Xml>
<File>
<File-Name>file.json</File-Name>
<Data>
<Map>
<String key="title">New product</String>
<Number key="price">12.2</Number>
<Array key="colors">
<Map>
<String key="colorType">MAIN</String>
<String key="colorValue">red</String>
</Map>
<Map>
<String key="colorType">MAIN</String>
<String key="colorValue">green</String>
</Map>
</Array>
</Map>
</Data>
</File>
</Json-To-Xml>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Definition
XPath | Description | Occurs |
---|---|---|
Json-To-Xml | Root of the document. | 1 |
./File | For each input file. | 1..* |
./File/File-Name | Original file name. | 1 |
./File/Data | The json converted as xml. | 1 |
Limits and additional notes
- The limitation of the input file size is 100 Mb.
- The input file must be encoded in UTF-8
FAQ
How to manage multiple JSON files?
Use mode = FILES
and the input files
. They will be automatically merged into one single XML file.