Read JSON
This task will read a JSON file into the Dex data stream.
CONFIGURATION
OPTION | DESCRIPTION |
---|---|
File Name | Use the browse button to select the JSON file which is to be read. The effective file name represents the interpolated and fully qualified file name. This is useful if there are environment variable components to the path. |
Format | Determines how the JSON file is read and converted. Read subsequent sections of this document to determine which format is right for your purposes. |
INPUT
None.
OUTPUT
The JSON file will be output to the Dex data stream. The next component in the flow will receive this as input.
Currently, this component translates the JSON file into a Name Value Pair (NVP) table. Alternate tabular transformations will be supported in later versions of the component.
Conversions
Since JSON comes in many shapes and forms, there are a number of ways to read this data into Dex. Each with it's own advantages and disadvantages.
- Tabular - Ideal for the storage of tabular data, makes assumptions about the storage of data.
- NVP - Can read virtually any type of JSON, however, the result can be difficult to work with.
Tabular
This is the default format. It is also the format used when writing JSON data from Dex. This format makes certain assumptions about nesting and simplifies the conversion between the default Dex data structure to and from JSON.
[
{
"firstname" : "bill",
"vehicle" : "truck"
},
{
"firstname" : "sally",
"vehicle" : "car"
}
]
This type of conversion will result in a table with structure:
firstname | vehicle |
---|---|
bill | truck |
sally | car |
Name / Value Pair
Given JSON:
[
{
"firstname" : "bill",
"vehicle" : "truck"
},
{
"firstname" : "sally",
"vehicle" : "car"
}
]
NVP Transformation produces a table of the form:
NAME | VALUE |
---|---|
root.firstname | bill |
root.vehicle | truck |
root.firstname | sally |
root.vehicle | car |
This can sometimes be difficult to parse, however has the advantage of being able to parse very complex and nested JSON data structures into a usable Dex stream.