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

Re: json date time objects

Expand Messages
  • S.Prasannarupan
    Does this mean that Date objects created using new Date() can be directly mapped to Java Objects? Can the date object created this way be formatted into
    Message 1 of 6 , Jul 11 10:10 PM
    • 0 Attachment
      Does this mean that Date objects created using new Date() can be
      directly mapped to Java Objects? Can the date object created this way
      be formatted into different date time formats?
      please let me know
      Thanks


      --- In json@yahoogroups.com, "brucehub33" <bruce.hubbard33@...> wrote:
      >
      > --- In json@yahoogroups.com, "rkmr.em@" <rkmr.em@> wrote:
      > >
      > > Does JSON support a datetime object?
      > >
      > > thanks
      > >
      > >
      > > [Non-text portions of this message have been removed]
      > >
      > you can put whole functions in a json object if you like. So in
      short
      > yes just make a new Date() object within you JSON object.
      >
    • Mert Sakarya
      Hi, JSON does not support either datetime object or function object. Look at BNF on http://www.json.org/ how value is defined. It contains, [ string ,
      Message 2 of 6 , Jul 11 10:19 PM
      • 0 Attachment
        Hi,

        JSON does not support either datetime object or function object. Look at BNF on http://www.json.org/ how "value" is defined.
        It contains, ["string", "number", "object", "array", "true", "false", "null"]. On this definition "object" is a JSON object (where you can find the definition above "value"), not a Javascript object.

        Although you can freely add something like new Date(2007, 7, 12, 0, 0, 0) or function(x,y) {return x+y;}, this makes that document a Javascript document (where you can eval), not JSON document.

        Mert



        To: json@yahoogroups.comFrom: bruce.hubbard33@...: Wed, 11 Jul 2007 23:32:28 +0000Subject: [json] Re: json date time objects




        --- In json@yahoogroups.com, "rkmr.em@..." <rkmr.em@...> wrote:>> Does JSON support a datetime object?> > thanks> > > [Non-text portions of this message have been removed]>you can put whole functions in a json object if you like. So in short yes just make a new Date() object within you JSON object.


        _________________________________________________________________
        Missed the show?  Watch videos of the Live Earth Concert on MSN.
        http://liveearth.msn.com

        [Non-text portions of this message have been removed]
      • Mert Sakarya
        You can write any date data as a string in a JSON document, then if you are using Java, C# or Javascript (or any other), you can use that language s, DateTime
        Message 3 of 6 , Jul 11 10:22 PM
        • 0 Attachment
          You can write any date data as a string in a JSON document, then if you are using Java, C# or Javascript (or any other), you can use that language's, DateTime functions to convert.


          To: json@yahoogroups.comFrom: prasannarupan@...: Thu, 12 Jul 2007 05:10:15 +0000Subject: [json] Re: json date time objects




          Does this mean that Date objects created using new Date() can be directly mapped to Java Objects? Can the date object created this way be formatted into different date time formats?please let me knowThanks--- In json@yahoogroups.com, "brucehub33" <bruce.hubbard33@...> wrote:>> --- In json@yahoogroups.com, "rkmr.em@" <rkmr.em@> wrote:> >> > Does JSON support a datetime object?> > > > thanks> > > > > > [Non-text portions of this message have been removed]> >> you can put whole functions in a json object if you like. So in short > yes just make a new Date() object within you JSON object.>


          _________________________________________________________________
          Don't get caught with egg on your face. Play Chicktionary!  
          http://club.live.com/chicktionary.aspx?icid=chick_wlmailtextlink

          [Non-text portions of this message have been removed]
        • Stephen M. McKamey
          Basically Dates are encoded as ISO 8601 strings by default (but this can be customized), and a hook or callback function allows you to deserialize them (or
          Message 4 of 6 , Jul 12 6:51 AM
          • 0 Attachment
            Basically Dates are encoded as ISO 8601 strings by default (but this
            can be customized), and a "hook" or callback function allows you to
            deserialize them (or any other node for that matter) during parseJSON.

            Functions are strictly not allowed in JSON as they are potentially
            meaningless to other languages as well as a potential security risks.

            There has also be some debates about Dates a couple of times before,
            which resulted in the above solution. Check out some of these threads
            for more info:

            http://tech.groups.yahoo.com/group/json/message/600
            http://tech.groups.yahoo.com/group/json/message/607
            http://tech.groups.yahoo.com/group/json/message/554
            http://tech.groups.yahoo.com/group/json/message/518

            --- In json@yahoogroups.com, Mert Sakarya <mertsakarya@...> wrote:
            >
            > You can write any date data as a string in a JSON document, then if
            you are using Java, C# or Javascript (or any other), you can use that
            language's, DateTime functions to convert.
            >
            >
            > To: json@...: prasannarupan@...: Thu, 12 Jul 2007 05:10:15
            +0000Subject: [json] Re: json date time objects
            >
            >
            >
            >
            > Does this mean that Date objects created using new Date() can be
            directly mapped to Java Objects? Can the date object created this way
            be formatted into different date time formats?please let me
            knowThanks--- In json@yahoogroups.com, "brucehub33"
            <bruce.hubbard33@> wrote:>> --- In json@yahoogroups.com, "rkmr.em@"
            <rkmr.em@> wrote:> >> > Does JSON support a datetime object?> > > >
            thanks> > > > > > [Non-text portions of this message have been
            removed]> >> you can put whole functions in a json object if you
            like. So in short > yes just make a new Date() object within you JSON
            object.>
            >
            >
            > _________________________________________________________________
            > Don't get caught with egg on your face. Play Chicktionary!  
            > http://club.live.com/chicktionary.aspx?icid=chick_wlmailtextlink
            >
            > [Non-text portions of this message have been removed]
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.