Skip to content

JSON Output

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: ... } }.

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.

OptionTypeDefaultDescription
format"json_array" | "ndjson""json_array"Serialisation shape. json_array wraps everything in [...]. ndjson writes one object per line.
prettyPrintbooleanfalsePretty-print with two-space indentation. Has no effect in NDJSON mode.
unflattenNestedbooleanfalseSplit dot-notation keys back into nested objects (e.g. address.city{ address: { city } }). Stops at five levels.

A small product catalogue exported as a flat JSON array.

Before:

skunameprice
W-001Widget9.99
G-001Gadget24.50
D-001Doohickey4.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 }
]

The upstream pipeline produced dot-notation columns for an address; downstream consumers expect nested objects.

Before:

customeraddress.cityaddress.countrytotal
Acme CorpValenciaES4250
Beta IncBerlinDE1875

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
}
]

A consumer that ingests one record per line — typical for analytics pipelines or jq post-processing.

Before:

eventuserts
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"}
  • prettyPrint only applies to json_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 ignores prettyPrint. See apps/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 ndjson when the consumer can read line-by-line and the dataset is large — memory stays roughly flat. json_array buffers every row before calling JSON.stringify. See apps/web/src/transforms/output-json/logic.ts:101-138.
  • CSV Output — write plain CSV when the consumer is a spreadsheet or shell tool.
  • Excel Output — write .xlsx when the consumer is Excel or another office suite.
  • JSON Input — round-trip JSON; pair with flattenNested and unflattenNested to flatten and rebuild nested shapes.