Serialize given data structure to JSON data objects (not a JSON string).
The resulting JSON object can be stringified using JSON.stringify().
interface Data { created: Date;}const json = serialize<Data>({created: new Date(1234567890123)});//json is {created: '2009-02-13T23:31:30.123Z'}const jsonString = JSON.stringify(json);//jsonString is '{"created":"2009-02-13T23:31:30.123Z"}'
ValidationError when serialization or validation fails.
Optional
Generated using TypeDoc
Serialize given data structure to JSON data objects (not a JSON string).
The resulting JSON object can be stringified using JSON.stringify().
Throws
ValidationError when serialization or validation fails.