Skip to content

Commit c658c26

Browse files
committed
Update specification_draft2.md
1 parent 1b755e8 commit c658c26

File tree

Image for: File tree

1 file changed

Image for: 1 file changed
+8
-16
lines changed

1 file changed

Image for: 1 file changed
+8
-16
lines changed

‎specification_draft2.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# LDJSON - Line delimited JSON
1+
# NDJSON - Newline delimited JSON
22

33
# Draft 2 (2013-07-27)
44

@@ -10,7 +10,7 @@ A standard for delimiting JSON in stream protocols (such as \[[TCP]\]).
1010

1111
There is currently no standard for transporting JSON within a stream protocol, apart from \[[Websockets]\], which is unnecessarily complex for non-browser applications.
1212

13-
There were numerous possibilities for JSON framing, including counted strings and non-ASCII delimiters (DLE STX ETX or Websocket�s 0xFFs).
13+
There were numerous possibilities for JSON framing, including counted strings and non-ASCII delimiters.
1414

1515
The primary use case for LDJSON is an unending stream of JSON objects, delivered at variable times, over TCP, where each object needs to be processed as it arrives. e.g. a stream of stock quotes or chat messages.
1616

@@ -32,41 +32,33 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
3232

3333
### 3.1 Sending
3434

35-
Each JSON object MUST be written to the stream followed by the newline character 0x0A. The JSON objects MUST NOT contain newlines or carriage returns.
35+
Each JSON object MUST be written to the stream followed by the newline character `\n` (0x0A). The newline charater MAY be preceeded by a carriage return `\r` (0x0D). The JSON objects MUST NOT contain newlines or carriage returns.
3636

3737
All serialized data MUST use the UTF8 encoding.
3838

3939
### 3.2 Receiving
4040

41-
The receiver MUST accept newline as line delimiter: �0x0A� (Unix)
41+
The receiver MUST accept newline as line delimiter `\n` (0x0A) as well as carriage return and newline `\r\n` (0x0D0A). The receiver SHOULD silently ignore empty lines, e.g. `\n\n`.
4242

4343
#### 3.2.1 Trivial Implementation
4444

4545
A simple implementation is to accumulate received lines. Every time a line ending is encountered, an attempt MUST be made to parse the accumulated lines into a JSON object.
4646

4747
If the parsing of the accumulated lines is successful, the accumulated lines MUST be discarded and the parsed object given to the application code.
4848

49-
If the amount of unparsed, accumulated characters exceeds 16MiB the receiver MAY close the stream. Resource constrained devices MAY close the stream at a lower threshold, though they MUST accept at least 1KiB.
50-
51-
#### 3.2.2 Other Implementations
52-
53-
Alternate, more efficient, implementations are possible using a custom JSON parser.
54-
55-
The reference NodeJS/Javascript implementation can be found on github.
56-
5749
### 3.3 MIME Type and File Extensions
5850

59-
When using HTTP/email the MediaType \[[RFC4288]\] for Line Delimited JSON SHOULD be _application/x-ldjson_.
51+
The MediaType \[[RFC4288]\] for Line Delimited JSON SHOULD be _application/x-ndjson_.
6052

61-
When saved in a file, the file extension SHOULD be _.ldjson_ or _.ldj_
53+
When saved in a file, the file extension SHOULD be _.ndjson_.
6254

6355
## 4. Copyright
6456

6557
This specification is copyrighted by the authors named in section 4.1. It is free to use for any purposes commercial or non-commercial.
6658

6759
### 4.1 Authors
6860

69-
The following authors are responsible for the LDJSON core-specification:
61+
The following authors are responsible for the NDJSON core-specification:
7062

7163
~~~~
7264
Thorsten Hoeger
@@ -86,7 +78,7 @@ Jim Wilson
8678
### 4.2 Contact
8779

8880
This specification and any related work is located at <https://github.com/ldjson>.
89-
Discussion and help can be found on the LDJSON Google group located at <https://groups.google.com/d/forum/ldjson>
81+
Discussion and help can be found on the issues page.
9082

9183
## A. References
9284

0 commit comments

Image for: 0 commit comments
Comments
 (0)