Serialize a class instance. Ignore properties with underscore prefix and include getters. Useful for overriding the toJSON function of
a class so that calls to JSON.stringify() will generate more appropriate JSON.
Parameters
instance: object
A class instance, usually this if classToJson is being used as a class method.
Serialize a class instance. Ignore properties with underscore prefix and include getters. Useful for overriding the
toJSONfunction of a class so that calls toJSON.stringify()will generate more appropriate JSON.