Output · Files
Write JSON
Saves the table as a JSON file: one array of objects, or one object per line.
Also known as: JSON Lines
How it works
Type the JSON file name (output.json by default) and pick a Location; blank means the project folder. Format is JSON array by default, one array with one object per row; NDJSON writes one object per line, which streams well into other tools. The write fails if the file already exists unless you tick Overwrite if the file already exists. Write formatted values writes values as they print upstream, which turns formatted numbers into strings. The written file is passed on downstream as a File.
Inputs and outputs
Inputs
data— Table
Outputs
file— File
Settings
The Attributes panel of Write JSON, as in the app: the controls work, but nothing runs — there is no data behind it.
The same settings, as the Assistant writes them
{
fileName: string
directory?: string
format: "array"|"ndjson"
overwrite?: boolean
formatValues?: boolean
}fileName is a basename, e.g. "sales.json"; directory empty = the project folder; "array" writes one JSON array, "ndjson" one object per line; overwrite off (default) fails rather than replacing an existing file; formatValues writes values as they print, which turns formatted numbers into strings
Example
A web app needs the latest product list. Set the JSON file to products.json, keep JSON array, tick Overwrite if the file already exists so each run refreshes it, and send the file on with S3 Sink.
| Format | File content |
|---|---|
| JSON array | [{"sku": "A1", "price": 9.5}, {"sku": "B2", "price": 12}] |
| NDJSON | {"sku": "A1", "price": 9.5} then {"sku": "B2", "price": 12} on the next line |