all files / json2typescript/ json-custom-convert.ts

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
100% Lines 0/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                                                                   
/**
 * Interface for custom conversion between JSON objects and TypeScript objects.
 *
 * You have to implement two methods:
 * - serialize() to map a TypeScript object to a JSON object
 * - deserialize() to map a JSON object to a TypeScript object
 *
 * @author Andreas Aeschlimann, DHlab, University of Basel, Switzerland
 * @see https://www.npmjs.com/package/json2typescript full documentation on NPM$
 */
export interface JsonCustomConvert<T> {
 
    /**
     * Converts an incoming TypeScript object to a plain JSON object.
     * Please note that the argument or resulting object can be primitive.
     *
     * @param data TypeScript object
     *
     * @return {any} JSON object
     */
    serialize(data: T): any;
 
    /**
     * Converts an incoming JSON object object to a TypeScript object.
     * Please note that the argument or resulting object can be primitive.
 
     * @param data JSON object
     *
     * @return {any} TypeScript object
     */
    deserialize(data: any): T;
 
}