Options
All
  • Public
  • Public/Protected
  • All
Menu

TS Serializer Docs

Index

Functions

Serialize

SerializeProperty

  • SerializeProperty decorator

    Note: Can only be used on class properties.

    How it works

    This annotation creates a new _serializeMap property on the class prototype and adds all decorated properties to this map. The Serializer will use this map to serialize and deserialize from/to json objects.

    Example

    Simple decorator

     @Serialize()
     class MyClass extends Serializable {
         @SerializeProperty()
         simpleProperty:string;
     }
    

    Decorator with options

     @Serialize()
     class MyClass extends Serializable {
         @SerializeProperty({
             map: 'someMapping',
             root: 'someObject'
         })
         simpleProperty:string;
     }
    

    Parameters

    • Default value options: PropertyOptions = {}

      A set of options to use when decorating a property.

    Returns PropertyDecorator

Generated using TypeDoc