Adds support for .toJSON in the stringifier.