W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2013

Re: [whatwg] asynchronous JSON.parse

From: Rick Waldron <waldron.rick@gmail.com>
Date: Thu, 7 Mar 2013 10:29:02 -0500
Message-ID: <CAHfnhfq5tUKnf1Gg8ktXVitGBaA0DntGGZeJ1Y3Q3uKky-181Q@mail.gmail.com>
To: "j@mailb.org" <j@mailb.org>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>
The JSON object and its API are part of the ECMAScript language
specification which is standardized by Ecma/TC39, not whatwg.


Rick

On Thursday, March 7, 2013, wrote:

> right now JSON.parse blocks the mainloop, this gets more and more of an
> issue as JSON documents get bigger and are also used as serialization
> format to communicate with web workers.
> To handle large JSON Documents there is a need for an async JSON.parse,
> something like:
>
>  JSON.parse(data, function(obj) { ... });
>
> or more like FileReader:
>
>  var json = new JSONReader();
>  json.addEventListener('load', function(event) {
>    //parsed JSON document in: this.result
>  });
>  json.parse(data);
>
> While my major need is asynchronous parsing of JSON data, the same is
> also true for serialization into JSON.
>
>  var json = new JSONWriter();
>  json.addEventListener('load', function(event) {
>    // serialized JSON string in: this.result
>  });
>  json.serialize(obj);
>
Received on Thursday, 7 March 2013 15:29:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 7 March 2013 15:29:48 GMT