aseemk/json5 — pull request #43 by rowanhill (2013-12-14 15:55:38+00:00)
Title: Observe custom toJSON methods when stringify is called on a value

Hi,

This PR addresses issue #39, observing toJSON in stringify() calls.

Happily, this means stringify() no longer needs to special-case Date objects: their toJSON function gets called like everything else.

Note also that even if the result of toJSON() has a toJSON function itself, that second function isn't called, apparently. I've put a test in for that case.

I've also updated the README.md to remove the text saying toJSON isn't supported and added a toJSON-based stringify() example.

Thanks,
Rowan