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

460RE: [json] JSON representation of common types

Expand Messages
  • Todd
    Jul 12, 2006
      Thanks for the great feedback Atif.

      But I’m really not looking to introduce behavior into JSON at all. I don’t
      think we even need to get that in depth in order to outline a basic way of
      returning the data inside the DataSet.

      A DataSet may be an object specific to .NET but each language has some form
      of object that represents data returned from a database. They may be known
      by a different names, get referenced with different syntax, and have
      slightly different behaviors associated with them. However, at the most
      fundamental level they are approximately the same thing, that being, a
      “flat” 2 dimensional data object (containing columns and rows).

      My thought is not to duplicate all the “behavioral baggage”. It is simply to
      take that data (columns and rows) and decide on a uniform way of
      representing it within JSON.

      In reality there are only two ways to look at DataSets, QueryBeans,

      1. An Array of Objects (where each object has an identical set of keys)
      2. An Object of Arrays (where each array can be assumed to be of the
      exact same length)

      These objects can also be returned at the root level or nested down inside a
      “wrapper” object that contains “supporting” key values such as column Lists,
      record counts, etc…

      Everyone who has ever written a JSON parser has come up with (in their own
      mind) a great way of doing this already. I simply feel it would be helpful
      to the JSON community as a whole, if we all decided on ONE way and everyone
      stick to that.

      Who gets to decide on what the standard is? I don’t know. I’m just trying
      to start some dialog and get people thinking about it.

      Again, maybe I’m way off track here. But it my mind it would be helpful to
      know I can write some JavaScript that dynamically iterates through an object
      and know it won’t break regardless of what parser encoded the string.

      Just a thought ;)


      From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of Atif
      Sent: Tuesday, July 11, 2006 10:08 AM
      To: json@yahoogroups.com
      Subject: RE: [json] JSON representation of common types

      I think you'll have a hard time getting input on standardization of DataSets
      because most folks who are not familiar with .NET Framework may have no clue
      what's being talked about. The DataSet type and concept carries a lot of
      structural and behavioral baggage with it. Unless one defines the general
      problem (without referring to library-specific types) that needs to be
      addressed and then keep the focus on the wire format, it's a lost cause. The
      DataSet is specific to the .NET Framework and what's mostly interesting
      about it is all the richness it provides to give nearly the sense of a
      disconnected database (short of stored procedures and a query language
      unless XPath cuts it for your case). Since JSON is not about behavior, one
      has to focus on the structure and the wire format. The behavior can be
      defined only through an abstract specification that defines a processing
      model for each end of the wire that wants to interoperate on that data. And,
      mind you, the more you put in there, the more behavior each party has to
      provide. For example, if you're going to ship over a DataSet in JSON to a
      Java application, then who's going through the trouble of making sure that
      something on the Java or JavaScript side can provide all the expected
      functionality, like producing updategrams when calling back into the server?
      Don't get me wrong. There's an interesting problem domain behind it all
      that's interesting to try and standardize, but I fear that it might be a bit
      out of scope for this group.


      From: json@yahoogroups. <mailto:json%40yahoogroups.com> com
      [mailto:json@yahoogroups. <mailto:json%40yahoogroups.com> com] On Behalf Of
      Sent: Tuesday, July 11, 2006 6:10 PM
      To: json@yahoogroups. <mailto:json%40yahoogroups.com> com
      Subject: RE: [json] JSON representation of common types

      Good question.

      Unless I'm mistaken a Dictionary is pretty much an associative array, which
      will follow the pattern of: {key:value,key:value,key:value}, and Lists will
      just be arrays [value,value,value]

      I know there is no standard for DataSet or DateTime. I started a thread
      about a DataSet standard and got some good feedback on the way people like
      to see them, but I didn't really get a strong sense of urgency about the
      subject of standardizing them. You can check out the thread here:
      http://groups. <http://groups.yahoo.com/group/json/message/436>
      yahoo.com/group/json/message/436 <http://groups.

      As for DateTime, again there is no formal standard other then just returning
      your data in a format that can be considered a date by both languages you
      are developing for (let's say C# and JavaScript).

      I personally feel that JSON would benefit greatly from standardizing
      DataSets and DateTime values so that as a developer, I know I can
      deserialize ANY value and know how to use it, without worrying about what
      serializer was used.

      Hope that helps,



      From: json@yahoogroups. <mailto:json%40yahoogroups.com> com
      <mailto:json%40yahoogroups.com> [mailto:json@yahoogroups.
      <mailto:json%40yahoogroups.com> com <mailto:json%40yahoogroups.com> ] On
      Behalf Of
      Michael Schwarz
      Sent: Tuesday, July 11, 2006 7:36 AM
      To: json@yahoogroups. <mailto:json%40yahoogroups.com> com
      Subject: [json] JSON representation of common types


      I'd like to know if there are already some common representations of
      common types like following .NET data types:

      - DataSet, DataTable
      - Dictionary
      - List, Collection
      - DateTime -> sometimes handeled as "new Date(...)" or maybe the
      SortablePattern string representation

      Best regards | Schöne Grüße

      Microsoft MVP - Most Valuable Professional
      Microsoft MCAD - Certified Application Developer

      http://weblogs. <http://weblogs. <http://weblogs.asp.net/mschwarz/>
      asp.net/mschwarz/ <http://weblogs. <http://weblogs.asp.net/mschwarz/>
      asp.net/mschwarz/> > asp.net/mschwarz/
      http://www.schwarz- <http://www.schwarz-
      <http://www.schwarz-interactive.de/> interactive.de/ <http://www.schwarz-
      <http://www.schwarz-interactive.de/> interactive.de/> > interactive.de/
      mailto:info@schwarz- <mailto:info%40schwarz-interactive.de> interactive.de

      [Non-text portions of this message have been removed]

      [Non-text portions of this message have been removed]

      [Non-text portions of this message have been removed]
    • Show all 19 messages in this topic