logoalt Hacker News

thayneyesterday at 1:09 AM0 repliesview on HN

> I believe their toString representations are compatible with JSON

Not quite. String is the big problem, since it needs to be wrapped in quotes, and special characters need to be escaped. But Float and Double are also problematic because Infinity and NaN aren't representable in json.

However, the new interface could have a "toJsonString" or maybe even a toJson method that returns a JsonValue