Task String - JSON Decode
The JSON Decode Task turns JSON from a file or a value into delimited text, one line for each JSON object, and writes it to the output or to a file.
The Main settings, Flow, On error, Conditions and TimeOut tabs are the same for every Task; see Job - Tasks.
JSON Decode tab

- Credentials: the Credential used to read the file when File is selected
- File (default): the full path of a JSON file. Click the file button to browse for it
- Variable/Value: the JSON as text or as a Variable. Click the Variable button to insert a Variable
- JSON object: optional. A JSONPath expression that selects the part of the JSON to decode, for example an array inside the document. When it is empty, or matches nothing, the whole JSON is decoded. Click the button next to it to open the JSON browser and select a path
- Map columns to properties (double click to edit): optional. Each row maps an output column (Name) to a property (Value), given as a path relative to each object, such as
Property1orInnerArray[0].Value. In the Add/Edit name value window, clear The value is the name of the JObject property to enter a value or a Variable instead of a property. Use Add, Edit and Delete to change the rows. Refresh removes every row from the map
Without a map, every property of each object becomes a column. If the JSON is an array, each item becomes one line; otherwise there is one line. An array value is written as its items separated by a comma and a space.
Output tab

- Include field names: writes the column names in the first line
- Indent XML: has no effect on this Task
- Field separator: the character between columns, "Tab" by default
- Text qualifier: an optional character written around text and date values
- Line break: the character between lines, "CrLf" by default
- Output to standard output (default): writes the result to the output of the Task
- Output to file: writes the result to the file in File path, read and written with the Credential selected above it
- Include BOM (if UTF8): checked by default. Writes a byte order mark when the Task code page is UTF-8
- Append to file: checked by default. Adds the result to the end of an existing file, after a line break. When cleared, an existing file is replaced without warning
With Output to file and Append to file cleared, an existing file at File path is replaced on each run.
With Output to file, the output of the Task is the path of the file.
Example
Input:
[
{
"Property1": "Value1",
"Property2": "Value2",
"InnerArray": [{ "Value": "item1" }, { "Value": "item2" }]
},
{
"Property1": "Value3",
"Property2": "Value4",
"InnerArray": [{ "Value": "item3" }, { "Value": "item4" }]
}
]
With the map Column1 = Property1, Column2 = Property2 and ArrayColumn = InnerArray[0].Value, and Include field names checked, the output is (columns separated by tabs):
Column1 Column2 ArrayColumn
Value1 Value2 item1
Value3 Value4 item3
Output and errors
If the file or the value is empty, the Task writes nothing, and the Task reports success.
If the input is not valid JSON, the Task fails.