Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ClassOptions

Defines the Serialize decorator options.

Hierarchy

Index

Properties

Properties

Optional root

root: string

Root path to use when mapping.

Example

 @Serialize({
     root: 'someObject'
 })
 class MyClass extends Serializable {
     @SerializeProperty()
     name:string;
 }

Deserialize

 let instance:MyClass = new MyClass();
 instance.deserialize({
     someObject: {
         name: 'some value'
     }
 });

 console.log(instance.name); // Will output 'some value'

Serialize

 let instance:MyClass = new MyClass();
 instance.name = 'value';

 console.log(instance.serialize()); // Will output {someObject:{name:'value'}}

Generated using TypeDoc