webshrine / stdtyp/src / SerializableToJSON
Interface: SerializableToJSON
Defines a type that can be serialised to a JSON string via the toJSON
method or JSON.stringify(...)
call
See
Example
ts
class SomeObject implements SerializableToJSON {
toJSON = () => '["SomeObject\'s data"]'
}
const str = JSON.stringify(new SomeObject()) // '["SomeObject's data"]'
#interface #atom #serialisation
Properties
toJSON()
toJSON: () =>
string
Returns
string