Loading ...
Sorry, an error occurred while loading the content.

244RE: [json] Dynamic type information

Expand Messages
  • Atif Aziz
    Feb 1, 2006
    • 0 Attachment
      I guess I should have mentioned that I was aware of class hinting from
      JSON-RPC. Although fine in principle, I find the method slightly
      intrusive, verbose and heavy-duty for simple data types. It's heavy-duty
      because you end up paying a lot of memory and processing tax for parsing
      the entire construction passage only to throw away the objects and
      replace them via the actual intended one. Imagine an array of holiday.
      Each item would be a date expressed as strings using ISO 8601. For each
      item, you would therefore have something like this:

      {"jsonclass":["ISODate",["1999-12-31"]]}

      That's a lot baggage (1 hashtable, 2 arrays and 3 strings per item),
      don't you think?

      -----Original Message-----
      From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of
      Michal Migurski
      Sent: Wednesday, February 01, 2006 9:11 PM
      To: json@yahoogroups.com
      Subject: Re: [json] Dynamic type information

      > JSON is limited to a few primitive types that serve quite well when
      > it's
      > enough to communicate all type information via documentation. For
      > example, a date is transmitted as a number and documented to be UTC
      > milliseconds from January 1, 1970 or it's transmitted as a string that
      > is documented to be using the ISO 8601 format. However, I am currently
      > investigating ways to dynamically add type information on to a JSON
      > stream in a JSON-ish manner. I have a couple of ideas that range from
      > less-than-ideal hacks to things that eventually surpass an empirical
      > keep-it-simple-stupid threshold. Has anybody tackled this problem and
      > come up with an elegant solution before I go off reinventing the
      > wheel?

      JSON-RPC defines a pattern called class hinting, see section 3 of
      http://json-rpc.org/specs.xhtml.

      It's close... sort of.

      ----------------------------------------------------------------
      michal migurski- contact info and pgp key:
      sf/ca http://mike.teczno.com/contact.html






      Yahoo! Groups Links
    • Show all 3 messages in this topic