JSON decoding

Erik Arvidsson erik.arvidsson at gmail.com
Tue Oct 24 14:33:34 PDT 2006


I guess I should have had an else case there as well :-)

On 10/24/06, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:
> '{"foo": [1, true, null]}'.parseJSON() -> {foo: [1, true, null]}
>
> And using a hook:
>
> '{"foo", [1, true, null]}'.parseJSON(function(obj) {
>   if (typeof obj == 'object' && 'foo' in obj) {
>     return 'Hello World'
>   }
> })
>
> ->
>
>  'Hello World'
>
> On 10/24/06, zwetan <zwetan at gmail.com> wrote:
> > On 10/24/06, Brendan Eich <brendan at mozilla.com> wrote:
> > > An application can replace the toJSONString method on an instance or
> > > a class to change its JSON serialization.
> > <snip>
> > > This is pretty minimal.  It reflects Bob's helpful comments.  It
> > > still gives Date default encoding better than what toString produces,
> > > to wit toISOString's result.  Without evolving JSON to talk about ISO
> > > date literals, this is as far as we want to go.  We could try to
> > > invent a string date convention that can round-trip, but it could
> > > conflict with JSON schemas in use now or in the future.  So we leave
> > > it to anyone who wants that to hook up Date.prototype.toJSONString.
> > >
> > > Comments welcome as always.
> > >
> >
> > Does ES4 will also provide functions for JSON deserialization ?
> > and if yes, are those function will also be replaceable ?
> > something in the line of Object.prototype.fromJSONString ?
> >
> > zwetan
> > _______________________________________________
> > Es4-discuss mailing list
> > Es4-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es4-discuss
> >
>
>
> --
> erik
>


-- 
erik



More information about the Es4-discuss mailing list