JSONFormat
Specifies the format of the JSON document. Requires Format to be set to JSON.
Possible Values
JSON, JSONRows, LDJSONData Type
string
Default Value
"JSON"
Remarks
This option allows you to specify the format of the JSON document, which enables parsing specifically for the selected format.
The following sections describe each available JSONFormat configuration.
JSON
This is the default format, and should be used most of the time.
JSONRows
In this format, data is returned in a relational format consisting of rows of data contained within primitive arrays. Column information is returned in a separate array.Note: This JSONFormat does not require you to set DataModel.
Example:
{
"dataset": {
"column_names": [
"Name",
"Age",
"Gender"
],
"data": [
[
"John Doe",
37,
"M"
],
[
"David Thomas",
25,
"M"
]
]
}
}
The XPath property requires special syntax to identify the column and row paths.
In this syntax, you specify a path for each using a "column:" and "row:" prefix.
For example, in the above example the XPath would be set to:
column:/dataset/column_names;row:/dataset/data
If columns are returned in an object with additional data, an additional "columnname:" prefix can be specified to identify the path to the value containing the column name.
Example:
{
"columns": [
{
"name":"first_name",
"type":"text"
},
{
"name":"last_name",
"type":"text"
}
],
"rows": [
[
"John",
"Doe"
],
[
"David",
"Thomas"
]
]
}
In the above example, XPath would be set to:
column:/columns;columnname:/columns.name;row:/rows
LDJSON (Line-Delimited JSON)
This format is used to parse line-delimited JSON files (also known as NDJSON or JSONLines). Line-delimited JSON files contain a separate JSON document on each line. Example LDJSON File:
{ "Name": "John Doe", "Age": 37, "Gender": "M" }
{ "Name": "David Thomas", "Age": 25, "Gender": "M" }
{ "Name": "Susan Price", "Age": 35, "Gender": "F" }
The XPath value is treated the same as when using the regular JSON format, except that the root path ($.) is always used.
In the above example, the XPath, "/", would return 3 rows containing the columns: Name, Age, and Gender.