JSON Output
Write the incoming row stream as a JSON array or as NDJSON (one JSON object per line). Optionally pretty-print the JSON array, and optionally reconstruct nested objects from dot-notation column names like
address.city→{ address: { city: ... } }.
How it works
Section titled “How it works”JSON Output is a sink node. It consumes the row stream and produces a Blob whose MIME type is application/json for arrays or application/x-ndjson for line-delimited output.
In json_array mode, every row is buffered before serialisation because JSON.stringify needs the full array. Pretty-printing adds two-space indentation. In ndjson mode each row is stringified and appended with a trailing newline as it arrives, so memory stays roughly constant.
When unflattenNested is true, dot-separated column names are split into nested object structure: address.city becomes { address: { city: ... } }. Reconstruction stops at five levels deep — keys with more dots than that are written as flat keys with literal dots in the name. Existing nested objects from the row are preserved as-is; only flat dotted keys are reshaped.
Input: A row stream from any upstream transform.
Output: A Blob containing a JSON array or NDJSON.
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
format | "json_array" | "ndjson" | "json_array" | Serialisation shape. json_array wraps everything in [...]. ndjson writes one object per line. |
prettyPrint | boolean | false | Pretty-print with two-space indentation. Has no effect in NDJSON mode. |
unflattenNested | boolean | false | Split dot-notation keys back into nested objects (e.g. address.city → { address: { city } }). Stops at five levels. |
Examples
Section titled “Examples”Default JSON array, compact
Section titled “Default JSON array, compact”A small product catalogue exported as a flat JSON array.
Before:
| sku | name | price |
|---|---|---|
| W-001 | Widget | 9.99 |
| G-001 | Gadget | 24.50 |
| D-001 | Doohickey | 4.25 |
Configuration: defaults — format: "json_array", prettyPrint: false, unflattenNested: false.
After (raw file content):
[ { "sku": "W-001", "name": "Widget", "price": 9.99 }, { "sku": "G-001", "name": "Gadget", "price": 24.5 }, { "sku": "D-001", "name": "Doohickey", "price": 4.25 }]Pretty-printed array with unflattening
Section titled “Pretty-printed array with unflattening”The upstream pipeline produced dot-notation columns for an address; downstream consumers expect nested objects.
Before:
| customer | address.city | address.country | total |
|---|---|---|---|
| Acme Corp | Valencia | ES | 4250 |
| Beta Inc | Berlin | DE | 1875 |
Configuration: format: "json_array", prettyPrint: true, unflattenNested: true.
After (raw file content):
[ { "customer": "Acme Corp", "address": { "city": "Valencia", "country": "ES" }, "total": 4250 }, { "customer": "Beta Inc", "address": { "city": "Berlin", "country": "DE" }, "total": 1875 }]NDJSON for log-style streaming
Section titled “NDJSON for log-style streaming”A consumer that ingests one record per line — typical for analytics pipelines or jq post-processing.
Before:
| event | user | ts |
|---|---|---|
| signup | [email protected] | 2026-02-10T08:30:00Z |
| login | [email protected] | 2026-02-10T08:31:14Z |
| login | [email protected] | 2026-02-10T09:02:55Z |
Configuration: format: "ndjson", unflattenNested: false.
After (raw file content):
{"event":"signup","user":"[email protected]","ts":"2026-02-10T08:30:00Z"}{"event":"login","user":"[email protected]","ts":"2026-02-10T08:31:14Z"}{"event":"login","user":"[email protected]","ts":"2026-02-10T09:02:55Z"}Tips and Edge Cases
Section titled “Tips and Edge Cases”prettyPrintonly applies tojson_array. In NDJSON mode it is ignored — each object is single-line by definition. The UI hides the checkbox when NDJSON is selected, but if a config object sets both, the runtime silently ignoresprettyPrint. Seeapps/web/src/transforms/output-json/logic.ts:101-117.- Unflattening stops at depth 5. Keys with six or more dot segments are written as flat keys with literal dots. This protects against pathological inputs but means deeply nested column names round-trip differently than shallow ones. See
apps/web/src/transforms/output-json/logic.ts:14, 36-42. - NDJSON is streaming; JSON array is not. Choose
ndjsonwhen the consumer can read line-by-line and the dataset is large — memory stays roughly flat.json_arraybuffers every row before callingJSON.stringify. Seeapps/web/src/transforms/output-json/logic.ts:101-138.
Related Transforms
Section titled “Related Transforms”- CSV Output — write plain CSV when the consumer is a spreadsheet or shell tool.
- Excel Output — write
.xlsxwhen the consumer is Excel or another office suite. - JSON Input — round-trip JSON; pair with
flattenNestedandunflattenNestedto flatten and rebuild nested shapes.