On 2018-03-18 20:23, Mike Samuel wrote:
It is possible that I don't understand what you are asking for here since I have no experience with toJSON.Based on this documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify> JSON.canonicalize() would though work out of the box (when integrated in the JSON object NB...) since it would inherit all the functionality (and 99% of the code) of JSON.stringify() JSON.stringify(new Date()) has specific semantics because Date.prototype.toJSON has specific semantics. As currently written, JSON.canonicalize(new Date()) === JSON.canonicalize({})
It seems that you (deliberately?) misunderstand what I'm writing above. JSON.canonicalize(new Date()) would do exactly the same thing as JSON.stringify(new Date()) since it apparently only returns a string. Again, the sample code I provided is a bare bones solution with the only purpose showing the proposed canonicalization algorithm in code as a complement to the written specification. Anders _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

