Actually, Douglas Crockford's JSON parser is a bit different, in order
to deal with issues such as Date format. From http://www.json.org/js.html:

The optional filter parameter is a function which will be called for
every key and value at every level of the final result. Each value
will be replaced by the result of the filter function. This can be
used to reform generic objects into instances of classes, or to
transform date strings into Date objects.

    myData = text.parseJSON(function (key, value) {
        return key.indexOf('date') >= 0 ? new Date(value) : value;
    });

As far as I'm concerned, that's typically something that could be
implemented at a later stage, which is why I omitted it from
String#evalJSON (and also why I called the method evalJSON rather than
parseJSON).

Regards,

Tobie




On Mar 8, 5:16 pm, "Rick Olson" <[EMAIL PROTECTED]> wrote:
> > And at that point, you've introduced a weird convention for treating
> > some strings differently from others.  Better, in my opinion, to let
> > the developer introduce whatever convention works best for him.
> > Date.parse makes this easy.
>
> That is true... the ruby parser uses a tokenizer, so I was thinking I
> could easily just update some parse_string method and be done.  I
> forgot that eval() was all that JS needed.
>
> --
> Rick Olsonhttp://weblog.techno-weenie.nethttp://mephistoblog.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to