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

469Re: [json] JSON representation of common types

Expand Messages
  • Fang Yidong
    Jul 17 6:16 AM
    • 0 Attachment
      I don't know. JSON sparkles in its simplicity.It's a
      challenge bring in an elegant and simple common type
      system,I think.Maybe Douglas can give some comments?

      --- Michael Schwarz <michael.schwarz@...>:

      > I've done some test on that, and almost all simple
      > web services that
      > offer JSON as output could be compiled using the XSD
      > compiler inside
      > .NET SDK, what was missing is always the response
      > class. In my Yahoo!
      > example (http://weblogs.asp.net/mschwarz/) I was
      > missing the ResultSet
      > class, which I wrote at my own. All other classes
      > could be created
      > using the XML schema. The only thing is that Yahoo!
      > i.e. doesn't use
      > the same data type for JSON as defined in the XML
      > schema.
      >
      > Do you we need a new schema or can we use XML schema
      > (the light way).
      > I would be very interessted in having a schema for
      > JSON, too.
      >
      > Regards,
      > Michael
      >
      >
      >
      >
      > On 7/17/06, Fang Yidong <fangyidong@...>
      > wrote:
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      > > Common datatypes seem to be a good idea. Maybe we
      > can
      > > do 'JSON schema'? :-)
      > >
      > > But as to XML schema, I think it's too
      > complicated.
      > >
      > > --- Michael Schwarz <michael.schwarz@...>:
      > >
      > >
      > > > Because I'm currently using .NET data types in
      > my
      > > > JSON parser, do you
      > > > think it would be a good idea to use common data
      > > > type identifiers like
      > > > used in XML schema?
      > > >
      > > >
      > >
      >
      http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#built-in-datatypes
      > > >
      > > > Regards,
      > > > Michael
      > > >
      > > >
      > > >
      > > > On 7/17/06, Fang Yidong
      > <fangyidong@...>
      > > > wrote:
      > > > >
      > > > >
      > > > > If used in general purpose,maybe it's good to
      > add
      > > > the
      > > > > table name and the field datatypes in the
      > metadata
      > > > > section.
      > > > >
      > > > > --- Mert Sakarya <msakarya@...>:
      > > > >
      > > > >
      > > > > > Hi, I am using readonly datasets in the
      > > > following
      > > > > > format;
      > > > > >
      > > > > > {
      > > > > > "DataSet" : {
      > > > > > "Tables" : [
      > > > > > {
      > > > > > "Fields" : ["Column1","ImgDate","Column2"],
      > > > > > "Records" : [
      > > > > > ["16.7.2006,Pazar","16.7.2006,Pazar",51],
      > > > > > ["9.7.2006,Pazar","9.7..2006,Pazar",54],
      > > > > > ...
      > > > > > ]
      > > > > > }
      > > > > > ]
      > > > > > },
      > > > > > "Parameters" : { //Any other you want to
      > return,
      > > > > > total number of records...
      > > > > > "RETURN_VALUE" : "0"
      > > > > > }
      > > > > > }
      > > > > >
      > > > > >
      > > > > >
      > > > > >
      > > > > > Mert Sakarya
      > > > >
      > >
      > > > > > IT Direkt姒�搴���
      > >
      > > > >
      > > > > >
      > > > > >
      > > > > >
      > > > > > Tel
      > > > > > : (212) 251 85 70 / 112
      > > > > > Fax
      > > > > > : (212) 251 89 50
      > > > > > www.yenibiris.com
      > > > > >
      > > > > > ________________________________________
      > > > > > From: json@yahoogroups.com
      > > > > > [mailto:json@yahoogroups.com] On Behalf Of
      > Todd
      > > > > > Sent: Thursday, July 13, 2006 12:02 AM
      > > > > > To: json@yahoogroups.com
      > > > > > Subject: RE: [json] JSON representation of
      > > > common
      > > > > > types
      > > > > >
      > > > > > 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,
      > > > > > Whatever.....
      > > > > >
      > > > > > 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
      >
      === message truncated ===



      --
      JSON: Action in AJAX!

      JSON - http://www.json.org
      JSON.simple - http://www.json.org/java/simple.txt




      ___________________________________________________________
      雅虎免费邮箱-3.5G容量,20M附件
      http://cn.mail.yahoo.com/
    • Show all 19 messages in this topic