<s>
JSON	B-Protocol
streaming	I-Protocol
comprises	O
communications	O
protocols	O
to	O
delimit	B-Algorithm
JSON	B-General_Concept
objects	O
built	O
upon	O
lower-level	O
stream-oriented	O
protocols	O
(	O
such	O
as	O
TCP	B-Protocol
)	O
,	O
that	O
ensures	O
individual	O
JSON	B-General_Concept
objects	O
are	O
recognized	O
,	O
when	O
the	O
server	O
and	O
clients	O
use	O
the	O
same	O
one	O
(	O
e.g.	O
</s>
<s>
This	O
is	O
necessary	O
as	O
JSON	B-General_Concept
is	O
a	O
non-concatenative	O
protocol	O
(	O
the	O
concatenation	O
of	O
two	O
JSON	B-General_Concept
objects	O
does	O
not	O
produce	O
a	O
valid	O
JSON	B-General_Concept
object	O
)	O
.	O
</s>
<s>
JSON	B-General_Concept
is	O
a	O
popular	O
format	O
for	O
exchanging	O
object	O
data	O
between	O
systems	O
.	O
</s>
<s>
Frequently	O
there	O
's	O
a	O
need	O
for	O
a	O
stream	O
of	O
objects	O
to	O
be	O
sent	O
over	O
a	O
single	O
connection	O
,	O
such	O
as	O
a	O
stock	O
ticker	O
or	O
application	B-Application
log	I-Application
records	I-Application
.	O
</s>
<s>
In	O
these	O
cases	O
there	O
's	O
a	O
need	O
to	O
identify	O
where	O
one	O
JSON	B-General_Concept
encoded	O
object	O
ends	O
and	O
the	O
next	O
begins	O
.	O
</s>
<s>
Send	O
the	O
JSON	B-General_Concept
objects	O
formatted	O
without	O
newlines	O
and	O
use	O
a	O
newline	O
as	O
the	O
delimiter	B-Algorithm
.	O
</s>
<s>
Send	O
the	O
JSON	B-General_Concept
objects	O
concatenated	O
with	O
a	O
record	O
separator	O
control	O
character	O
as	O
the	O
delimiter	B-Algorithm
.	O
</s>
<s>
Send	O
the	O
JSON	B-General_Concept
objects	O
concatenated	O
with	O
no	O
delimiters	B-Algorithm
and	O
rely	O
on	O
a	O
streaming	O
parser	O
to	O
extract	O
them	O
.	O
</s>
<s>
Send	O
the	O
JSON	B-General_Concept
objects	O
prefixed	O
with	O
their	O
length	O
and	O
rely	O
on	O
a	O
streaming	O
parser	O
to	O
extract	O
them	O
.	O
</s>
<s>
Line-delimited	O
JSON	B-General_Concept
works	O
very	O
well	O
with	O
traditional	O
line-oriented	B-Operating_System
tools	I-Operating_System
.	O
</s>
<s>
Concatenated	O
JSON	B-General_Concept
works	O
with	O
pretty-printed	B-Application
JSON	B-General_Concept
but	O
requires	O
more	O
effort	O
and	O
complexity	O
to	O
parse	O
.	O
</s>
<s>
It	O
does	O
n't	O
work	O
well	O
with	O
traditional	O
line-oriented	B-Operating_System
tools	I-Operating_System
.	O
</s>
<s>
Concatenated	O
JSON	B-Protocol
streaming	I-Protocol
is	O
a	O
superset	O
of	O
line-delimited	O
JSON	B-Protocol
streaming	I-Protocol
.	O
</s>
<s>
Length-prefixed	O
JSON	B-General_Concept
works	O
with	O
pretty-printed	B-Application
JSON	B-General_Concept
.	O
</s>
<s>
It	O
does	O
n't	O
work	O
well	O
with	O
traditional	O
line-oriented	B-Operating_System
tools	I-Operating_System
,	O
but	O
may	O
offer	O
performance	O
advantages	O
over	O
line-delimited	O
or	O
concatenated	O
streaming	O
.	O
</s>
<s>
Two	O
terms	O
for	O
equivalent	O
formats	O
of	O
line-delimited	O
JSON	B-General_Concept
are	O
:	O
</s>
<s>
Newline	O
delimited	B-Algorithm
(	O
NDJSON	O
)	O
-	O
The	O
old	O
name	O
was	O
Line	O
delimited	B-Algorithm
JSON	B-General_Concept
(	O
LDJSON	O
)	O
.	O
</s>
<s>
Streaming	O
makes	O
use	O
of	O
the	O
fact	O
that	O
the	O
JSON	B-General_Concept
format	O
does	O
not	O
allow	O
return	O
and	O
newline	O
characters	O
within	O
primitive	O
values	O
(	O
in	O
strings	O
those	O
must	O
be	O
escaped	B-Algorithm
as	O
\r	O
and	O
\n,	O
respectively	O
)	O
and	O
that	O
most	O
JSON	B-General_Concept
formatters	O
default	O
to	O
not	O
including	O
any	O
whitespace	O
,	O
including	O
returns	O
and	O
newlines	O
.	O
</s>
<s>
These	O
features	O
allow	O
the	O
newline	O
character	O
or	O
return	O
and	O
newline	O
character	O
sequence	O
to	O
be	O
used	O
as	O
a	O
delimiter	B-Algorithm
.	O
</s>
<s>
This	O
example	O
shows	O
two	O
JSON	B-General_Concept
objects	O
(	O
the	O
implicit	O
newline	O
characters	O
at	O
the	O
end	O
of	O
each	O
line	O
are	O
not	O
shown	O
)	O
:	O
</s>
<s>
The	O
use	O
of	O
a	O
newline	O
as	O
a	O
delimiter	B-Algorithm
enables	O
this	O
format	O
to	O
work	O
very	O
well	O
with	O
traditional	O
line-oriented	B-Operating_System
Unix	I-Operating_System
tools	I-Operating_System
.	O
</s>
<s>
which	O
is	O
very	O
easy	O
to	O
sort	O
by	O
date	O
,	O
grep	B-Application
for	O
usernames	O
,	O
actions	O
,	O
IP	O
addresses	O
,	O
etc	O
.	O
</s>
<s>
Line-delimited	O
JSON	B-General_Concept
can	O
be	O
read	O
by	O
a	O
parser	O
that	O
can	O
handle	O
concatenated	O
JSON	B-General_Concept
.	O
</s>
<s>
Concatenated	O
JSON	B-General_Concept
that	O
contains	O
newlines	O
within	O
a	O
JSON	B-General_Concept
object	O
ca	O
n't	O
be	O
read	O
by	O
a	O
line-delimited	O
JSON	B-General_Concept
parser	O
.	O
</s>
<s>
The	O
terms	O
"	O
line-delimited	O
JSON	B-General_Concept
"	O
and	O
"	O
newline-delimited	O
JSON	B-General_Concept
"	O
are	O
often	O
used	O
without	O
clarifying	O
if	O
embedded	O
newlines	O
are	O
supported	O
.	O
</s>
<s>
In	O
the	O
past	O
the	O
NDJ	O
specification	O
(	O
"	O
newline-delimited	O
JSON	B-General_Concept
"	O
)	O
allowed	O
comments	O
to	O
be	O
embedded	O
if	O
the	O
first	O
two	O
characters	O
of	O
a	O
given	O
line	O
were	O
"	O
//	O
"	O
.	O
</s>
<s>
This	O
could	O
not	O
be	O
used	O
with	O
standard	O
JSON	B-General_Concept
parsers	O
if	O
comments	O
were	O
included	O
.	O
</s>
<s>
Concatenated	O
JSON	B-General_Concept
can	O
be	O
converted	O
into	O
line-delimited	O
JSON	B-General_Concept
by	O
a	O
suitable	O
JSON	B-General_Concept
utility	O
such	O
as	O
jq	O
.	O
</s>
<s>
Record	O
separator-delimited	O
JSON	B-Protocol
streaming	I-Protocol
allows	O
JSON	B-General_Concept
text	O
sequences	O
to	O
be	O
delimited	B-Algorithm
without	O
the	O
requirement	O
that	O
the	O
JSON	B-General_Concept
formatter	O
exclude	O
whitespace	O
.	O
</s>
<s>
Since	O
JSON	B-General_Concept
text	O
sequences	O
cannot	O
contain	O
control	O
characters	O
,	O
a	O
record	O
separator	O
character	O
can	O
be	O
used	O
to	O
delimit	B-Algorithm
the	O
sequences	O
.	O
</s>
<s>
In	O
addition	O
,	O
it	O
is	O
suggested	O
that	O
each	O
JSON	B-General_Concept
text	O
sequence	O
be	O
followed	O
by	O
a	O
line	O
feed	O
character	O
to	O
allow	O
proper	O
handling	O
of	O
top-level	O
JSON	B-General_Concept
objects	O
that	O
are	O
not	O
self	O
delimiting	B-Algorithm
(	O
numbers	O
,	O
true	O
,	O
false	O
,	O
and	O
null	O
)	O
.	O
</s>
<s>
This	O
format	O
is	O
also	O
known	O
as	O
JSON	B-General_Concept
Text	O
Sequences	O
or	O
MIME	B-Application
type	I-Application
application/json	O
-seq	O
,	O
and	O
is	O
formally	O
described	O
in	O
IETF	O
.	O
</s>
<s>
The	O
example	O
below	O
shows	O
two	O
JSON	B-General_Concept
objects	O
with	O
␞	O
representing	O
the	O
record	O
separator	O
control	O
character	O
and	O
␊	O
representing	O
the	O
line	O
feed	O
character	O
:	O
</s>
<s>
Concatenated	O
JSON	B-Protocol
streaming	I-Protocol
allows	O
the	O
sender	O
to	O
simply	O
write	O
each	O
JSON	B-General_Concept
object	O
into	O
the	O
stream	O
with	O
no	O
delimiters	B-Algorithm
.	O
</s>
<s>
It	O
relies	O
on	O
the	O
receiver	O
using	O
a	O
parser	O
that	O
can	O
recognize	O
and	O
emit	O
each	O
JSON	B-General_Concept
object	O
as	O
the	O
terminating	O
character	O
is	O
parsed	O
.	O
</s>
<s>
Concatenated	O
JSON	B-General_Concept
is	O
n't	O
a	O
new	O
format	O
,	O
it	O
's	O
simply	O
a	O
name	O
for	O
streaming	O
multiple	O
JSON	B-General_Concept
objects	O
without	O
any	O
delimiters	B-Algorithm
.	O
</s>
<s>
The	O
advantage	O
of	O
this	O
format	O
is	O
that	O
it	O
can	O
handle	O
JSON	B-General_Concept
objects	O
that	O
have	O
been	O
formatted	O
with	O
embedded	O
newline	O
characters	O
,	O
e.g.	O
,	O
pretty-printed	B-Application
for	O
human	O
readability	O
.	O
</s>
<s>
Implementations	O
that	O
rely	O
on	O
line-based	O
input	O
may	O
require	O
a	O
newline	O
character	O
after	O
each	O
JSON	B-General_Concept
object	O
in	O
order	O
for	O
the	O
object	O
to	O
be	O
emitted	O
by	O
the	O
parser	O
in	O
a	O
timely	O
manner	O
.	O
</s>
<s>
This	O
is	O
rarely	O
recognised	O
as	O
an	O
issue	O
because	O
terminating	O
JSON	B-General_Concept
objects	O
with	O
a	O
newline	O
character	O
is	O
very	O
common	O
.	O
</s>
<s>
Length-prefixed	O
or	O
framed	O
JSON	B-Protocol
streaming	I-Protocol
allows	O
the	O
sender	O
to	O
explicitly	O
state	O
the	O
length	O
of	O
each	O
message	O
.	O
</s>
<s>
It	O
relies	O
on	O
the	O
receiver	O
using	O
a	O
parser	O
that	O
can	O
recognize	O
each	O
length	O
n	O
and	O
then	O
read	O
the	O
following	O
n	O
bytes	O
to	O
parse	O
as	O
JSON	B-General_Concept
.	O
</s>
<s>
The	O
advantage	O
of	O
this	O
format	O
is	O
that	O
it	O
can	O
speed	O
up	O
parsing	O
due	O
to	O
the	O
fact	O
that	O
the	O
exact	O
length	O
of	O
each	O
message	O
is	O
explicitly	O
stated	O
,	O
rather	O
than	O
forcing	O
the	O
parser	O
to	O
search	O
for	O
delimiters	B-Algorithm
.	O
</s>
<s>
Length-prefixed	O
JSON	B-General_Concept
is	O
also	O
well-suited	O
for	O
TCP	B-Protocol
applications	O
,	O
where	O
a	O
single	O
"	O
message	O
"	O
may	O
be	O
divided	O
into	O
arbitrary	O
chunks	O
,	O
because	O
the	O
prefixed	O
length	O
tells	O
the	O
parser	O
exactly	O
how	O
many	O
bytes	O
to	O
expect	O
before	O
attempting	O
to	O
parse	O
a	O
JSON	B-General_Concept
string	O
.	O
</s>
<s>
This	O
example	O
shows	O
two	O
length-prefixed	O
JSON	B-General_Concept
objects	O
(	O
with	O
each	O
length	O
being	O
the	O
byte-length	O
of	O
the	O
following	O
JSON	B-General_Concept
string	O
)	O
:	O
</s>
<s>
can	O
both	O
create	O
and	O
read	O
line-delimited	O
JSON	B-General_Concept
texts	O
.	O
</s>
<s>
Jackson	B-Language
(	O
API	O
)	O
can	O
read	O
and	O
write	O
line-delimited	O
JSON	B-General_Concept
texts	O
.	O
</s>
<s>
logstash	B-Application
includes	O
a	O
.	O
</s>
<s>
is	O
a	O
C++	O
library	O
that	O
supports	O
line-delimited	O
JSON	B-General_Concept
.	O
</s>
<s>
A	O
set	O
of	O
tools	O
to	O
manipulate	O
line	O
delimited	B-Algorithm
JSON	B-General_Concept
(	O
generate	O
,	O
transform	O
,	O
collect	O
statistics	O
,	O
and	O
format	O
results	O
)	O
.	O
</s>
<s>
The	O
Go	O
standard	O
library	O
's	O
package	O
can	O
be	O
used	O
to	O
read	O
and	O
write	O
line-delimited	O
JSON	B-General_Concept
.	O
</s>
<s>
can	O
both	O
create	O
and	O
read	O
record	O
separator-delimited	O
JSON	B-General_Concept
texts	O
.	O
</s>
<s>
Jackson_(API )	O
can	O
read	O
and	O
write	O
concatenated	O
JSON	B-General_Concept
content	O
.	O
</s>
<s>
–	O
Yet	O
Another	O
JSON	B-General_Concept
Library	O
.	O
</s>
<s>
YAJL	O
is	O
a	O
small	O
event-driven	O
(	O
SAX-style	O
)	O
JSON	B-General_Concept
parser	O
written	O
in	O
ANSI	O
C	O
,	O
and	O
a	O
small	O
validating	O
JSON	B-General_Concept
generator	O
.	O
</s>
<s>
is	O
a	O
C++	O
library	O
that	O
supports	O
concatenated	O
JSON	B-General_Concept
.	O
</s>
<s>
JsonStreamParser.java	O
can	O
read	O
concatenated	O
JSON	B-General_Concept
.	O
</s>
<s>
is	O
a	O
streaming	O
JSON	B-General_Concept
parser	O
for	O
python	O
.	O
</s>
