Native JSON loading (was: system module loader)

Gray Zhang otakustay at gmail.com
Thu Mar 15 01:20:26 PDT 2012


I’d like this idea, especially when native JSON loading is combined with JSONPath (if possibly provided by standard http://goessner.net/articles/JsonPath/ ), e.g. I have a large JSON formatted content served by server:
  Content-Type: application/json
  {
      brief: {
          // 10 properties
      }, /* This is a stop-point */
      // other 100+ properties, over 2MB in size
  }
Once native JSON loading is suppoted, when I load a uri with JSONPath such as ./api/info.json#brief, would it be possible that user agent streamed this response, read until the close of *brief* property (The stop-point in code example), then close this connection (or other ways to notify server that remaining content is not required), this would (in some case) be benefit for network performance.

Gray Zhang
Mail: otakustay at gmail.com
Blog: http://www.otakustay.com
Weibo: http://www.weibo.com/otakustay

From: Wes Garland 
Sent: Friday, March 09, 2012 1:42 AM
To: David Bruant 
Cc: es-discuss 
Subject: Re: Native JSON loading (was: system module loader)

> What about native JSON loading?

How would this be different from XHR + JSON.parse() sugar?

Are you proposing loading the JSON from the server as though it were a module?

FWIW, most of my JSON-loading use cases are post-page-load, they are of the "fetch some data from the server based on user input" variety.

In a very very very small number of cases (session state mostly) I also will load data at the same time as page load; for these cases I currently use SCRIPT tags and code ~ like this on the server

print("Content-type: application/x-javascript\n")
/* do stuff */
print "var o = " + uneval(o);

Wes

-- 
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102



--------------------------------------------------------------------------------
_______________________________________________
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/20120315/30944458/attachment.html>


More information about the es-discuss mailing list