Skip to main content
How-to guide
The JSON connector reads JSON objects and writes one object per line. It supports append and whole-dataset overwrite.

Before you start

Prepare storage and a client connection using Read and write files. For the read example, save these two lines in an accessible .json file:

Read data

Use an explicit schema when fields must have stable types:
Expect (1, 12.5) and (2, 7.5). If the column list is omitted, the reader discovers a schema from a bounded sample. JSON does not accept the CSV/TSV inferSchema option.

Read a JSON document

For a formatted object or a top-level array of objects, set multiLine 'true':
Every record must be an object. The whole document must fit the schema inspection and read budgets for this mode.

Write data

Use the spark connection from the shared file guide. The writer always produces JSON Lines, including when the input came from a JSON array.
Use mode("append") to add rows. SQL also supports a directory export:
Choose the client example or the SQL export for a destination. Both overwrite the active dataset.

Options

Use shared read options for paths, file filtering, and storage access. The writer has no configurable JSON format options. It does not accept multiLine. Only uncompressed JSON output is supported.

Data types and limits

JSON field names map to columns. JSON numbers, booleans, strings, nulls, arrays, and objects are interpreted through the selected schema. An explicit schema avoids type changes caused by a different inference sample. Supported file suffixes are .json, .jsonl, and .ndjson. Match the suffix used by your input when setting pathGlobFilter. Header, delimiter, quote, and nullValue are not JSON options. Row updates, deletes, and merges are not supported by this file sink. Use Iceberg or Delta Lake when those table operations are needed.
Last modified on November 23, 2026