On Wed, May 23, 2012 at 3:00 PM, Mark Hahn <m...@hahnca.com> wrote:
>>   it seems that the work on the client side to do streaming parsing gets
>> much harder
>
> I don't understand?  Parsing commas is hard?  However you planned on parsing
> newlines could parse commas instead.

It goes from trivial (because you don't have to inspect the JSON at
all) to not-trivial (because you do).

JSON can contain commas, but unless it's created using a pretty-indent
argument, it can never contain newlines.  This means that your parser
only has to be aware of a single byte, and can dumbly skip over
everything else.

I think what we need is a new standard for \n delimited JSON streams.
It addresses a slightly different need (since you won't ever parse the
whole thing all at once, and it may not even ever end), and requires
the sender to not send pretty-formatted JSON, so that each object is
guaranteed to be a single line.

Actually, I think that's basically the spec:

1. Lines are delimited by \n (0x0A)
2. Each line must be a valid JSON string in UTF-8 encoding.

The only thing we're lacking is a mime-type.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to