This does not actually return a JSON representation of the object, but a custom serialization format. You should not call it `toJson`. (rather something like simply `serialize` - not `toString` neither, because in this case we might accept losing information, it's just for display)

While I agree on the fact we should not confuse JSON representation and JavaScript objects, and therefore that to be strict JSON should always be represented in JavaScript as a string, I don't agree with calling any serialization function `toJson` (onyl if they actually produce JSON)