Re: [WebIDL] toJSON

Le 31/05/2012 09:47, Simon Pieters a écrit :
> On Wed, 30 May 2012 19:30:43 +0200, David Bruant <bruant.d@gmail.com> 
> wrote:
>
>> Hi,
>>
>> My reading of the current state of the spec is that
>> JSON.stringify(anyEvent) is '{}' which is close to useless.
>
> Why can't we change JSON.stringify() to make it not useless instead of 
> sprinkling toJSON on everything?
JSON.stringify is part of ECMAScript 5 is widely deployed and used all 
over the place. I'm not against the idea of changing it upfront, but how 
do you do that without introducing backward-compat issue?

Adding a toJSON seems to be less intrusive.

David

Received on Thursday, 31 May 2012 08:26:41 UTC