Flat File Document
Parse a delimited flat file into JSON rows, or create a delimited flat file from JSON rows.
Revision History
0.0.0.4 - Initial release.
0.0.0.11 - Current release.
Setup Notes
- Delimiter values accept escaped characters such as
\r,\n,\t, and\\.
Methods
Parse
Reads a delimited flat file document and returns one JSON object for each row.
Use this method when you need to turn a flat file into rows that downstream Steps can process one at a time.
| Parameter | Type | Description |
|---|---|---|
Document |
Stream | The flat-file document to parse. |
Options.RowDelimiter |
String | The row delimiter. The default is \r\n. |
Options.ColumnDelimiter |
String | The column delimiter. The default is ,. |
Options.FirstRowContainsColumnHeaders |
Boolean | When true, the first row is treated as column headers. The default is true. |
| Return | Type | Description |
|---|---|---|
Rows |
Array | One JSON object for each parsed row. |
Create
Renders a list of JSON objects as a delimited flat file document.
The column order in the rendered flat file document is taken from the first JSON object in Items. Properties that only appear in later items are not added as new columns.
| Parameter | Type | Description |
|---|---|---|
Items |
Array | The JSON rows to write to the document. Each item should be a JSON object. |
Options.RowDelimiter |
String | The row delimiter to write. The default is \r\n. |
Options.ColumnDelimiter |
String | The column delimiter to write. The default is ,. |
Options.FirstRowContainsColumnHeaders |
Boolean | When true, the first output row contains column headers. The default is true. |
| Return | Type | Description |
|---|---|---|
Document |
Stream | The rendered flat file document. |
Usage Notes
- When
FirstRowContainsColumnHeadersistrue, the first row becomes the property names in each returned JSON row. - If the file has duplicate header names, this Node makes them unique by appending a numeric suffix such as
Thing2andThing3. - If a data row has more cells than the header row, extra values are returned with generated names such as
Column3. - If
FirstRowContainsColumnHeadersisfalse, every row is treated as data and columns are namedColumn1,Column2, and so on. - Nested JSON values are not expanded into columns. Objects are written as
(object)and arrays are written as(array).
Known Issues
- This Node only handles delimited flat files. Fixed-width parsing and rendering are current not supported.
Parsecurrently supports the default Windows row format of\r\n. Other row delimiters are not supported for parsing.