Format Atlas

Compare

JSON Lines vs CSV

JSON Lines places one independent JSON value on each line, while CSV arranges fields into rows and columns. JSON Lines handles nested or varying record structures more naturally; CSV suits tabular data with consistent columns.

Which format should you choose?

Choose CSV to exchange a table with consistent columns between spreadsheets or databases. Consider JSON Lines for nested values or record-by-record streaming. Agree on encoding, delimiters, line endings, schema, and spreadsheet auto-conversion with recipients.

Good fit for JSON Lines

Logs and records processed line by line · Streaming exchange of JSON records

  • Reading and writing records incrementally
  • Appending or combining text data with common tools

Good fit for CSV

Tabular-data exchange

  • Transferring one simple table between applications

Basic information

FieldJSON LinesCSV
Extension.jsonl, .ndjson.csv
MIME typeapplication/jsonltext/csv
Common usesLogs and records processed line by line · Streaming exchange of JSON recordsTabular-data exchange
How to openOpen the file in a text editor or a JSON Lines-aware tool. Validating each line as JSON makes it easier to identify the record containing a syntax error.When importing into a spreadsheet, set the character encoding and delimiter. Check that leading zeros, date-like values, and long numbers are not automatically converted.
Export or convertTo create a JSON array, collect the lines as array elements. To convert an array to JSON Lines, write each value on its own line. For large files, consider memory use during conversion.Exporting XLSX to CSV normally writes values from only one selected sheet. Keep formulas, formatting, other sheets, and charts separately.

Choose by use case

Reading and writing records incrementally

Logs and records processed line by line · Streaming exchange of JSON records

JSON Lines

Appending or combining text data with common tools

Logs and records processed line by line · Streaming exchange of JSON records

JSON Lines

Transferring one simple table between applications

Tabular-data exchange

CSV

Key point 1

Each JSON Lines line contains one JSON value, including objects, arrays, strings, or numbers. CSV is a table of rows and fields; column meanings and types are often agreed separately, because CSV has no universal type schema.

More on the differences

Key point 2

JSON values can contain nested objects and arrays. CSV usually expects a consistent set of columns per row, so nested or optional fields need a separate schema or custom encoding.

More on the differences

More on the differences

Use CSV for a conventional table and JSON Lines when records are nested or processed individually. Parse CSV according to its quoting, delimiter, and embedded-newline rules.

  • Both text formats can be processed incrementally, but CSV parsers must handle quoting, delimiters, and newlines inside fields.
  • When converting, define how headers, column types, missing values, empty strings, dates, and leading zeros map; validate values after a round trip.

Frequently asked questions

Can CSV represent nested JSON values directly?

Not as a portable native structure. A cell can contain encoded text, but consumers need an agreed convention or schema to interpret it.

Learn more

References and specifications