toJSON() is named incorrectly - doesn't return JSON
dalhundal opened this issue · 1 comments
dalhundal commented
It's really bugging me that this method is called toJSON
but it's not actually returning JSON - it returns an Object - there's a big difference.
I don't want it to return JSON, I just mean to say that the method name is wrong.
felixge commented
I see your point, but this method is implementing a standardized JS interface:
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON .