Newline Delimited JSON
This work is licensed under the
Creative Commons Attribution-ShareAlike
License 4.0.
- Extension(s):
.jsonl
,.ndjson
.- Media Type(s):
application/jsonl
,application/x-ndjson
.
- Latest Version:
- index.shtml
Introduction
Two types of equivalent formats of line-delimited JSON are:
- Newline Delimited Javascript Object Notation (NDJSON) — The old name was Line Delimited JSON (LDJSON), but was renamed to avoid confusion with JSON-LD[#]
- Javascript Object Notation Lines (JSON Lines, JSONL)[#]
NDJSON makes use of the fact that the JSON format does not allow return
and newline characters within primitive values (in strings those must
be escaped as “\r
” and
“\n
”, respectively) and that most
JSON formatters
default to not including any whitespace, including returns and
newlines. These features allow the newline character or return and
newline character sequence to be used as a delimiter.
In the past the NDJ specification (“newline-delimited
JSON”) allowed
comments to be embedded if the first two characters of a given line
were “//
”. This could not be used with
standard JSON parsers
if comments were included. The current version of the specification
(“NDJSON - Newline delimited JSON”) no longer includes
comments.
References and Further Reading
- Contributors of Wikipedia: JSON streaming: Newline-Delimited JSON. Wikimedia Foundation, Inc.
-
Thorsten Hoeger, Chris Dew, Finn Pauls, Jim Wilson: NDJSON - Newline delimited
JSON. NDJSON.org.
A standard for delimiting JSON in stream protocols.
-
ndjson
- Newline Delimited JSON. NDJSON.org.
Official website of the NDJSON format. Has links to libraries in various programming and scripting languages to decode and encode it.
-
JSON
Lines. JSONLines.Org.
Official website and specification of the JSON Lines format.