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

Re: [json] JSON representation of common types

Expand Messages
  • Fang Yidong
    Because string,number,boolean and null is build-in in JSON,maybe types represented in string like date be more helpful. ...
    Message 1 of 19 , Jul 17, 2006
    • 0 Attachment
      Because string,number,boolean and null is build-in in
      JSON,maybe types represented in string like 'date' be
      more helpful.


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

      > Here is an example I'm currently using:
      >
      > {
      > "dataSet" : {
      > "tables" : [
      > {
      > "name": "My Table 1",
      > "columns" :
      >
      [["Column1","string"],["ImgDate","string"],["Column2","int"]],
      > "rows" : [
      > ["16.7.2006,Pazar", "16.7.2006,Pazar",
      > 51],
      > ["9.7.2006,Pazar", "9.7..2006,Pazar", 54],
      > ...
      > ] // end of rows
      > }
      > ] // end of tables
      > }
      > }
      >
      >
      >
      >
      >
      >
      >
      >
      > On 7/17/06, Michael Schwarz
      > <michael.schwarz@...> wrote:
      > > 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
      > > > > 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
      > > > > Aziz
      > > > > Sent: Tuesday, July 11, 2006 10:08 AM
      > > > > To: json@yahoogroups.com
      > > > > Subject: RE: [json] JSON representation of
      > common
      >
      === 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
    • Fang Yidong
      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?
      Message 2 of 19 , Jul 17, 2006
      • 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/
      • Michael Schwarz
        For date, time,... I use this currently: http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#isoformats ... -- Best regards | Schöne Grüße Michael Microsoft
        Message 3 of 19 , Jul 17, 2006
        • 0 Attachment
          For date, time,... I use this currently:

          http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#isoformats



          On 7/17/06, Fang Yidong <fangyidong@...> wrote:
          >
          >
          >
          >
          >
          >
          >
          > Because string,number,boolean and null is build-in in
          > JSON,maybe types represented in string like 'date' be
          > more helpful.
          >
          > --- Michael Schwarz <michael.schwarz@...>:
          >
          >
          > > Here is an example I'm currently using:
          > >
          > > {
          > > "dataSet" : {
          > > "tables" : [
          > > {
          > > "name": "My Table 1",
          > > "columns" :
          > >
          > [["Column1","string"],["ImgDate","string"],["Column2","int"]],
          > > "rows" : [
          > > ["16.7.2006,Pazar", "16.7.2006,Pazar",
          > > 51],
          > > ["9.7.2006,Pazar", "9.7..2006,Pazar", 54],
          > > ...
          > > ] // end of rows
          > > }
          > > ] // end of tables
          > > }
          > > }
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > On 7/17/06, Michael Schwarz
          > > <michael.schwarz@...> wrote:
          > > > 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
          > > > > > 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
          > > > > > Aziz
          > > > > > Sent: Tuesday, July 11, 2006 10:08 AM
          > > > > > To: json@yahoogroups.com
          > > > > > Subject: RE: [json] JSON representation of
          > > common
          > >
          >
          > === 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
          >
          >
          >
          >



          --
          Best regards | Schöne Grüße
          Michael

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

          http://weblogs.asp.net/mschwarz/
          http://www.schwarz-interactive.de/
          mailto:info@...
        • Atif Aziz
          I ve been doing some thinking along these lines for my work on the JSON-RPC 1.1 specification. In JSON-RPC 1.1, I added introspection support for services,
          Message 4 of 19 , Jul 17, 2006
          • 0 Attachment
            I've been doing some thinking along these lines for my work on the
            JSON-RPC 1.1 specification. In JSON-RPC 1.1, I added introspection
            support for services, meaning that there would be a standard way to
            describe a service, its procedures and the paramterers of those
            procedures. Needless to say, the last bit needs some type-hinting
            support, especially for the strongly-typed languages so that they have a
            chance of generating reasonable proxy code. I am not completely done
            with all the ideas, but I can shed some light on what I've come up with
            so far.

            JSON supports 6 data types. As everyone probably can guess, these are
            Object, Array, String, Number, Boolean and Null. In JSON-RPC 1.1, these
            take the form "object", "array", "string", "number", "bool" and "null"
            in text. Dead simple so far, but now let's get to the fun part. From
            this, how do you express types representing an array of integers versus
            an array of floats? How do you express a type for dates expressed in ISO
            8601 format versus those in Unix time? The first rule I came up with is
            not to violate or hide the 6 JSON types. These should always be stated
            as the root relation of some new type so that parties that don't
            understand the extension can still work with the basic ones they know
            about. In other words, you express a new data type as specialization of
            one of the 6 fundamental types. The type specification expression looks
            roughly like this:

            type-spec := json-type "/" sub-type
            json-type := "null" | "bool" | "number" |
            "string" | "object" | "array"

            If you think about it, it looks a lot like MIME-type specification, as
            in "text/plain". This is no coincidence. I wanted a familiar syntax so
            that people can pick it up quickly and recall it easily. Short of
            writing the spec here, the best way to demonstrate how it works is by
            showing you a few examples, so here are some concrete ones I have been
            working on:

            * string/w3time = String containing time using ISO 8601 format.
            * string/time = String containing time using unix time format.
            * string/guid = String containing a GUID.
            * number/time = Number containing time using unix time format.
            * number/int32 = Number that is a 32-bit integer.
            * number/int64 = Number that is a 64-bit integer
            * number/float = Number with single precision.
            * number/double = Number with double precision.
            * number/decimal = Number for financial application.
            * array/string = Array of String values.
            * array/object = Array of Object values.

            You can also now combine to form further hierarchies, which is mostly
            useful in the Array case, as in:

            * array/string/time = Array of String values containing time using
            unix time format.
            * array/number/int32 = Array of 32-bit integers.

            The important thing to realize is that a consumer can stop processing at
            the first slash and take only the pure JSON type on its left if it
            wishes to ignore the rest. What's more, it can do this without fear of
            loosing information that will be held in the containing super type. For
            example, if a consumer treats "string/w3time" as String then the time
            information has not been lost. It's just delivered to the application as
            a String as opposed to a type that is more representative of time in the
            development language of the application.

            In the case of Object, it would be possible to say, "object/person",
            provided that you describe person somewhere as:

            { "name" : "string",
            "sirname" : "string",
            "birthday" : "string/time"
            "children" : "array/object/person" }

            In the last case, you see that "children" is defined as array of
            "person" Object values.

            Finally, as common sense would tell us, so goes the rule...types such as
            Null and Boolean cannot be specialized. A consumer would simple ignore
            any specialization.

            Anyway, there you have it. Hope I've been able to give an idea of how I
            am planning to solve the problem for JSON-RPC 1.1, but it certainly has
            a wider application and you're free to see if it fits your needs (as in
            describing the column types of a table of records). Meanwhile, I've
            tried to keep it simple and effective while allowing for fallback cases.
            Thoughts?


            --- In json@yahoogroups.com, Fang Yidong <fangyidong@...> wrote:
            >
            > 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/
            >




            [Non-text portions of this message have been removed]
          • Michael Schwarz
            Are you talking about a JSON schema or a message? Where do you want to put the type? I think there are two scenarios where type meta information is neccesary:
            Message 5 of 19 , Jul 18, 2006
            • 0 Attachment
              Are you talking about a JSON schema or a message? Where do you want to
              put the type? I think there are two scenarios where type meta
              information is neccesary:

              1) if we have to describe a JSON "message" comparing to XSD to create
              classes on other side. I had a look at the Yahoo! search that are
              currently similar to their XSDs.

              2) If we return objects which will inherit from others. Where do you
              want to add the additional information? Again, I think, we are talking
              about something like the __type property.


              Michael



              On 7/18/06, Atif Aziz <atif.aziz@...> wrote:
              >
              >
              > I've been doing some thinking along these lines for my work on the
              > JSON-RPC 1.1 specification. In JSON-RPC 1.1, I added introspection
              > support for services, meaning that there would be a standard way to
              > describe a service, its procedures and the paramterers of those
              > procedures. Needless to say, the last bit needs some type-hinting
              > support, especially for the strongly-typed languages so that they have a
              > chance of generating reasonable proxy code. I am not completely done
              > with all the ideas, but I can shed some light on what I've come up with
              > so far.
              >
              > JSON supports 6 data types. As everyone probably can guess, these are
              > Object, Array, String, Number, Boolean and Null. In JSON-RPC 1.1, these
              > take the form "object", "array", "string", "number", "bool" and "null"
              > in text. Dead simple so far, but now let's get to the fun part. From
              > this, how do you express types representing an array of integers versus
              > an array of floats? How do you express a type for dates expressed in ISO
              > 8601 format versus those in Unix time? The first rule I came up with is
              > not to violate or hide the 6 JSON types. These should always be stated
              > as the root relation of some new type so that parties that don't
              > understand the extension can still work with the basic ones they know
              > about. In other words, you express a new data type as specialization of
              > one of the 6 fundamental types. The type specification expression looks
              > roughly like this:
              >
              > type-spec := json-type "/" sub-type
              > json-type := "null" | "bool" | "number" |
              > "string" | "object" | "array"
              >
              > If you think about it, it looks a lot like MIME-type specification, as
              > in "text/plain". This is no coincidence. I wanted a familiar syntax so
              > that people can pick it up quickly and recall it easily. Short of
              > writing the spec here, the best way to demonstrate how it works is by
              > showing you a few examples, so here are some concrete ones I have been
              > working on:
              >
              > * string/w3time = String containing time using ISO 8601 format.
              > * string/time = String containing time using unix time format.
              > * string/guid = String containing a GUID.
              > * number/time = Number containing time using unix time format.
              > * number/int32 = Number that is a 32-bit integer.
              > * number/int64 = Number that is a 64-bit integer
              > * number/float = Number with single precision.
              > * number/double = Number with double precision.
              > * number/decimal = Number for financial application.
              > * array/string = Array of String values.
              > * array/object = Array of Object values.
              >
              > You can also now combine to form further hierarchies, which is mostly
              > useful in the Array case, as in:
              >
              > * array/string/time = Array of String values containing time using
              > unix time format.
              > * array/number/int32 = Array of 32-bit integers.
              >
              > The important thing to realize is that a consumer can stop processing at
              > the first slash and take only the pure JSON type on its left if it
              > wishes to ignore the rest. What's more, it can do this without fear of
              > loosing information that will be held in the containing super type. For
              > example, if a consumer treats "string/w3time" as String then the time
              > information has not been lost. It's just delivered to the application as
              > a String as opposed to a type that is more representative of time in the
              > development language of the application.
              >
              > In the case of Object, it would be possible to say, "object/person",
              > provided that you describe person somewhere as:
              >
              > { "name" : "string",
              > "sirname" : "string",
              > "birthday" : "string/time"
              > "children" : "array/object/person" }
              >
              > In the last case, you see that "children" is defined as array of
              > "person" Object values.
              >
              > Finally, as common sense would tell us, so goes the rule...types such as
              > Null and Boolean cannot be specialized. A consumer would simple ignore
              > any specialization.
              >
              > Anyway, there you have it. Hope I've been able to give an idea of how I
              > am planning to solve the problem for JSON-RPC 1.1, but it certainly has
              > a wider application and you're free to see if it fits your needs (as in
              > describing the column types of a table of records). Meanwhile, I've
              > tried to keep it simple and effective while allowing for fallback cases.
              > Thoughts?
              >
              >
              > --- In json@yahoogroups.com, Fang Yidong <fangyidong@...> wrote:
              > >
              > > 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/
              > >
              >
              >
              > [Non-text portions of this message have been removed]
              >
              >
              >
              >
              >



              --
              Best regards | Schöne Grüße
              Michael

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

              http://weblogs.asp.net/mschwarz/
              http://www.schwarz-interactive.de/
              mailto:info@...
            • Mert Sakarya
              I think, simplicity in mind, JSON is not strong-typed, types are only Variants in JSON. I think, we only have, null, true/false, number and string (and we
              Message 6 of 19 , Jul 18, 2006
              • 0 Attachment
                I think, simplicity in mind, JSON is not strong-typed, types are only "Variants" in JSON. I think, we only have, null, true/false, number and string (and we also have Array and Object structures). So we can only use these types in JSON-Schema.

                There is no date, float, function and other primitive/complex types.

                I think, JSON-Schema should be simple and it should contain only the basic types/definitions.
                JSON-Schema can have, Constraints (May contain regular expressions - this way Date/Time or float types can be handled), Min-Max validations and definition of Object and Arrays...

                I admit that, I use Date and "function" or any other JavaScript types in my code, but I don't call them JSON (Well I decided to not to, after becoming a member of this group).
                For example adding Dataset to JSON is not possible, it could only be a "recommendation".

                Hey, what about J(SON)Pointer and J(SON)Include like XPointer and XInclude? Well that's another topic but something interesting.

                I am wondering, if we should keep JSON simple or add more extensions and make it complex?Mert


                To: json@yahoogroups.comFrom: michael.schwarz@...: Mon, 17 Jul 2006 12:35:55 +0200Subject: Re: [json] JSON representation of common types




                Because I'm currently using .NET data types in my JSON parser, do youthink it would be a good idea to use common data type identifiers likeused in XML schema?http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#built-in-datatypesRegards,MichaelOn 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> > 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> > Aziz> > 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> > 2> > 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.> > <http://groups.yahoo.com/group/json/message/436>> > yahoo.com/group/json/message/436>> >> > 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).> >>> === message truncated ===>> --> JSON: Action in AJAX!>> JSON - http://www.json.org> JSON.simple - http://www.json.org/java/simple.txt>>>>>>> __________________________________________________________> Mp3疯狂搜-新歌热歌高速下> http://music.yahoo.com.cn/?source=mail_mailbox_footer>>>>>>> -- Best regards | Schöne GrüßeMichaelMicrosoft MVP - Most Valuable ProfessionalMicrosoft MCAD - Certified Application Developerhttp://weblogs.asp.net/mschwarz/http://www.schwarz-interactive.de/mailto:info@...


                _________________________________________________________________
                Try Live.com: where your online world comes together - with news, sports, weather, and much more.
                http://www.live.com/getstarted

                [Non-text portions of this message have been removed]
              • Andy
                Hi, I went to the root of the conversation since I couldn t find a good spot elsewhere for this thought: I think JSON is fine as-is. If you want something
                Message 7 of 19 , Aug 7, 2006
                • 0 Attachment
                  Hi,
                  I went to the root of the conversation since I couldn't find a good
                  spot elsewhere for this thought:
                  I think JSON is fine as-is. If you want something that can carry more
                  complicated data types, use XML. If you want something simple, use
                  JSON. If you're after something in the middle, make up something new.

                  The way JSON defines types is by its delimiters.
                  Currently, we have {} for objects, [] for arrays, "" for strings and
                  nothing for numbers, and true, false, and null stand alone.
                  If you wish to add more strict data types, you need to add more
                  delimiter choices. Perhaps Parenthesis should be used for Dates ()
                  and angle brackets <> for another type. The question eventually
                  becomes, when are there enough?

                  Incorporating limits for values is beyond the scope of JSON as a data
                  serializer. The point of JSON is to efficiently get data from here to
                  there. The end-points are responsabile for understanding the
                  capabilities and limitations of the data. If you need to communicate
                  those, do so in a separate set of correspondance. This can either be
                  off-line in some agreement, talking to yourself while making up an
                  AJAX app, or through some nifty schema description language. In any
                  case, don't mix data with schema.

                  Another way: If I were a bakery, I don't need to tell my courier that
                  he's sending bread and include direction on how to eat it each time I
                  send it. I expect the recipient to know how to eat bread, and if he
                  doesn't, he can come to my shop and ask for any of my wonderful
                  sandwich recipies, but I don't need to ship my collection of recipies
                  with every order of bread.

                  IMarv
                  Andy Bay
                  --- In json@yahoogroups.com, "Michael Schwarz" <michael.schwarz@...>
                  wrote:
                  >
                  > Hi,
                  >
                  > 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
                  > Michael
                  >
                  > Microsoft MVP - Most Valuable Professional
                  > Microsoft MCAD - Certified Application Developer
                  >
                  > http://weblogs.asp.net/mschwarz/
                  > http://www.schwarz-interactive.de/
                  > mailto:info@...
                  >
                • Matt
                  Out of band data for creating types in other languages which don t cleanly/easily support raw javascript types should be done as optional data, which can still
                  Message 8 of 19 , Aug 8, 2006
                  • 0 Attachment
                    Out of band data for creating types in other languages which don't
                    cleanly/easily support raw javascript types should be done as optional
                    data, which can still be encoded as json.

                    It should be easy enough to take your objects before json encoding,
                    and run them through a function to turn them into wrapper objects, the
                    additional data you need being stored in properties, without polluting
                    json or json-rpc directly.

                    Assuming you know that the consumer of the data needs these additional
                    suggestions as to type election, otherwise as Andy said that `burden`
                    should be on the decoder to figure it out.


                    --
                    Matthew P. C. Morley
                    MPCM Technologies Inc.
                  Your message has been successfully submitted and would be delivered to recipients shortly.