Issue metadata
Sign in to add a comment
|
JSON.stringify() doesn't respect toJSON() if it is bound
Reported by
denis.wa...@futurice.com,
May 22 2016
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
Steps to reproduce the problem:
Run the following code:
const o = {a: 1};
o.toJSON = function() { return {b: 2}; }.bind(this);
console.log(JSON.stringify(o));
What is the expected behavior?
toJSON() should be called and the output should be '{"b":2}'.
What went wrong?
toJSON() is ignored and '{"a":1}' is returned, as if the toJSON property wouldn't exist.
Did this work before? N/A
Chrome version: 50.0.2661.102 Channel: stable
OS Version: OS X 10.11.4
Flash Version: Shockwave Flash 21.0 r0
The same code works as intended on Firefox 45.0.1.
,
May 23 2016
Confirmed that this works fine on Chrome 52.
,
May 23 2016
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by l446240525@gmail.com
, May 23 2016