Please help with writing spec for async JSON APIs
Alexander Jones
alex at weej.com
Mon Aug 3 08:28:39 UTC 2015
Personally I just use small JSON records delimited by newlines in my
'streaming' applications. Best of both worlds IMO.
On Monday, 3 August 2015, Brendan Eich <brendan at mozilla.org> wrote:
> Exactly! Incremental and async, i.e., streaming.
>
> XML quickly needed such APIs (
> https://en.wikipedia.org/wiki/Simple_API_for_XML,
> https://en.wikipedia.org/wiki/StAX). JSON's in the same boat.
>
> /be
>
> Bruno Jouhier wrote:
>
>> A common use case is large JSON feeds: header + lots of entries + trailer
>>
>> When processing such feeds, you should not bring the whole JSON in memory
>> all at once. Instead you should process the feed incrementally.
>>
>> So, IMO, an alternate API should not be just asynchronous, it should also
>> be incremental.
>>
>> FWIW, I have implemented an incremental/evented parser for V8 with a
>> simple API. This parser is incremental but not async (because V8 imposes
>> that materialization happen in the main JS thread). But, if the V8
>> restriction could be lifted, it could be made async with the same API. See
>> https://github.com/bjouhier/i-json
>>
>> i-json's API is a simple low level API. A more sophisticated solution
>> would be a duplex stream.
>>
>> There was also a long discussion on this topic on node's GitHub:
>> https://github.com/joyent/node/issues/7543
>>
>> Bruno
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150803/8f09b0dd/attachment.html>
More information about the es-discuss
mailing list