Representation of a value object that can be serialized to JSON via a toJSON method.
The type that the toJSON method should return
class User implements CanBeSerialized<{ id: number; name: string }> { constructor(private id: number, private name: string) {} toJSON() { return { id: this.id, name: this.name } }} Copy
class User implements CanBeSerialized<{ id: number; name: string }> { constructor(private id: number, private name: string) {} toJSON() { return { id: this.id, name: this.name } }}
Converts the object to a JSON-serializable representation
Representation of a value object that can be serialized to JSON via a toJSON method.