json-flatten (Transform Node)
The JSON Flatten node takes a single JSON input and flattens it into a wide tabular format (CSV or TSV). You can optionally target a specific array via a JMESPath expression (root); nested objects become dotted column names (e.g. a.b.c), and arrays can be expanded by index (key.0, key.1) or joined into a single column.
Use this node when you need to turn nested JSON (e.g. from an API or a previous transform) into rows and columns for analytics, CSV export, or downstream tabular nodes like tabular-query or tabular-remap.
Configuration Schema
| Property | Type | Required | Description |
|---|---|---|---|
inputMode | "all" | "latest" | No | Input selection policy. all enumerates all available parent outputs (can duplicate rows if parents emit cumulative snapshots). latest uses only the most recent parent output. Defaults to all. |
jsonInputFormat | "json" | "ndjson" | No | json (default): parse the whole payload as a single JSON value, then apply root. ndjson: UTF-8 JSON Lines (newline-delimited JSON): each non-empty line is one complete JSON value, parsed with json.loads independently; root is evaluated per line. Use root empty when each line is already one row object (typical for hydrate-protobuf SimulationFrame output with lineDelimitedJson). |
root | string | No | JMESPath expression that selects the array to flatten. If empty or omitted, the entire input is treated as the root (must be array-like in json mode). In ndjson mode, an empty root selects the whole line object as one row. Defaults to "". |
outputFormat | "csv" | "tsv" | No | Delimiter for the output. Defaults to csv. |
separator | string | No | Character used to join nested keys into column names (e.g. a.b.c). Defaults to ".". |
arrayHandling | "index" | "join" | No | How to represent arrays: index produces columns like key.0, key.1; join produces one column with values joined by arrayJoinSep. Defaults to index. |
arrayJoinSep | string | No | Used when arrayHandling is join. Defaults to `" |
include | array<string> | No | Optional whitelist of dotted paths (JMES-like) to include. If empty, all paths are included. |
exclude | array<string> | No | Optional blacklist of dotted paths to exclude. |
nullValue | string | No | String to emit for null/missing values. Defaults to "". |
castNumbers | boolean | No | When true, emit numbers as plain strings without trailing .0 where possible. Defaults to true. |
Behaviour
- Input selection (
inputMode):\n - Default (all): the node enumerates all available upstream outputs and selects the first payload in that enumeration.\n -latest: the node uses only the latest upstream output.\n - When to uselatest: when the parent node outputs cumulative snapshots over time (for example, repeated hydrate runs where later outputs contain all earlier data). Usinglatestavoids reprocessing earlier partial snapshots and reduces duplicated rows.\n+ - Note on multi-output parents:
inputMode: "all"enumerates outputs and some runtime paths return a list of payloads for a single parent (one per upstream output). In that case, this node selects the first payload in that list. - The node parses the upstream payload according to
jsonInputFormat(default single-document JSON). - In
ndjsonmode, each non-empty line must be one complete JSON value (often one object). Pretty-printed JSON with newlines inside a single array is not NDJSON; usejsonmode with a streaming parser upstream or keep one JSON document. - If
rootis set, it evaluates the JMESPath expression and uses the result as the set of rows to flatten (or, inndjson, the result per line). Injsonmode the result must be array-like; each element is typically an object. - If
rootis empty, the whole input is used injsonmode (and must be an array of objects, or a single object treated as one row). Inndjsonmode, each line object is one row. - For each row (object), nested keys are flattened into column names using
separator(e.g.user.name→ columnuser.name). Arrays are handled according toarrayHandling. - The
includeandexcludelists filter which columns appear in the output. - All values are stringified for CSV/TSV;
nullValueis used for nulls or missing keys.
Example configuration
{
"root": "items",
"outputFormat": "csv",
"separator": ".",
"arrayHandling": "index",
"arrayJoinSep": "|",
"nullValue": "",
"castNumbers": true
}Input (excerpt):
{
"items": [
{ "id": 1, "user": { "name": "Alice", "role": "driver" } },
{ "id": 2, "user": { "name": "Bob", "role": "observer" } }
]
}Output CSV:
id,user.name,user.role
1,Alice,driver
2,Bob,observerIntegration in a session template
- Place a
json-flattennode after any node that emits JSON. - Set
rootto the JMESPath for the array to flatten (e.g.items,data.rows), or leave empty to flatten the whole input. - Choose
outputFormat,arrayHandling, and optionalinclude/excludeto shape the table. - Connect downstream nodes (e.g. tabular-remap, tabular-query, or dashboard tools) to consume the CSV/TSV.
Related concepts
- Core Utils Runner
- Node Templates
- Tabular Remap (to further transform the flattened table)