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

Re: Questions re javascript parseJSON()

Expand Messages
  • Tim
    ... This date is coming back from AjaxPro s JavaScriptSerializer.Serialize() method. Is this not following the standard? Is anyone else using AjaxPro? Are
    Message 1 of 5 , Sep 20, 2006
    • 0 Attachment
      --- In json@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
      >
      > > I'm experimenting with using parseJSON() rather than a simple 'eval'.
      > > It seems to work except for dates. Given the following code, obj3
      > > returns false, but test4 returns a valid object with a date.
      > >
      > > var test3 = "{\"ADate\":new Date(Date.UTC(2005,7,12,9,46,4,677))}";
      > > var obj3 = test3.parseJSON();
      >
      > > Can anyone explain this? Am I missing something?
      > >
      > > Also, while I'm familar with Regex, I'm having a hard time
      > > understanding what parseJSON is really filtering. Can anyone point to
      > > an explanation of what's really happening?
      >
      > Your test3 string does not conform to the rules for a JSON text. You
      > can find the rules at http:/www.JSON.org/
      >

      This date is coming back from AjaxPro's
      JavaScriptSerializer.Serialize() method. Is this not following the
      standard?

      Is anyone else using AjaxPro? Are you just overriding the
      DateConverter to use ToString() and return something like
      Mon, 25 Dec 1995 13:30:00 GMT?

      Thanks,
      Tim
    • Michael Schwarz
      Hi, yes, AjaxPro is not using the standard, it is using something to get AJAX running on web browsers without parsing a lot. The second thing is that AjaxPro
      Message 2 of 5 , Sep 20, 2006
      • 0 Attachment
        Hi,

        yes, AjaxPro is not using "the" standard, it is using something to get AJAX
        running on web browsers without parsing a lot. The second thing is that
        AjaxPro will try to simulate .NET programming style (like DataSets or
        DataTables).

        I was in discussion with others but there was nobody who wants to parse each
        date, so this is the reason why I use "new Date()" instead of a simple
        string.

        AjaxPro enables to build converters, and there is a new DateTime converter
        that is doing one of the JSON standard, also possible to serialize to the
        sortable date format (year-month-day T hour:minute:second).

        Regards,
        Michael




        On 9/20/06, Tim <tryan@...> wrote:
        >
        > --- In json@yahoogroups.com <json%40yahoogroups.com>, "Douglas
        > Crockford" <douglas@...> wrote:
        > >
        > > > I'm experimenting with using parseJSON() rather than a simple 'eval'.
        > > > It seems to work except for dates. Given the following code, obj3
        > > > returns false, but test4 returns a valid object with a date.
        > > >
        > > > var test3 = "{\"ADate\":new Date(Date.UTC(2005,7,12,9,46,4,677))}";
        > > > var obj3 = test3.parseJSON();
        > >
        > > > Can anyone explain this? Am I missing something?
        > > >
        > > > Also, while I'm familar with Regex, I'm having a hard time
        > > > understanding what parseJSON is really filtering. Can anyone point to
        > > > an explanation of what's really happening?
        > >
        > > Your test3 string does not conform to the rules for a JSON text. You
        > > can find the rules at http:/www.JSON.org/
        > >
        >
        > This date is coming back from AjaxPro's
        > JavaScriptSerializer.Serialize() method. Is this not following the
        > standard?
        >
        > Is anyone else using AjaxPro? Are you just overriding the
        > DateConverter to use ToString() and return something like
        > Mon, 25 Dec 1995 13:30:00 GMT?
        >
        > Thanks,
        > Tim
        >
        >
        >



        --
        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/

        Skype: callto:schwarz-interactive
        MSN IM: passport@...


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.