UNPKG

ts-object-mapper

Version:

A TypeScript library to serialize and deserialize JSON objects

23 lines (22 loc) 1.07 kB
import { Type } from "./type"; export declare class ObjectMapper { private static Instance; protected static getInstance(): ObjectMapper; static serialize<T>(obj: T | T[]): string; static serialize<T, J>(obj: T, jtype: Type<J>): J; static serialize<T, J>(obj: T[], jtype: Type<J>): J[]; static deserialize<T>(type: Type<T>, json: string): T; static deserialize<T, J>(type: Type<T>, json: J): T; static deserializeArray<T>(type: Type<T>, json: string): T[]; static deserializeArray<T, J>(type: Type<T>, json: J[]): T[]; constructor(); serialize<T>(obj: T | T[]): string; serialize<T, J>(obj: T, jtype: Type<J>): J; serialize<T, J>(obj: T[], jtype: Type<J>): J[]; deserialize<T>(type: Type<T>, json: string): T; deserialize<T, J>(type: Type<T>, json: J): T; deserializeArray<T>(type: Type<T>, json: string): T[]; deserializeArray<T, J>(type: Type<T>, json: J[]): T[]; protected serializeObject<T, J>(obj: T, jtype: Type<J>): J; protected deserializeObject<T, J>(type: Type<T>, json: J): T; }