Class Serialization

Serialization class with static methods for serializing and deserializing objects. Properties and classes can be marked serializable by adding serialize and serializable decorators.

Hierarchy

  • Serialization

Constructors

Properties

SerializableClasses: Map<string, any> = ...
Serializers: Serializer[] = ...

Serializers for primitive, array and struct/custom object types

TypeMap: Map<ObjectConstructor, [string, string][]> = ...

Methods

  • Deserialize an object

    Parameters

    • data: any

      data to deserialize

    • obj: any

      current object that's set. If of the same class/type the data is deserialized into that instead of creating new objects.

    • Optional meta: Record<string, any>

      Optional object to retrieve common meta-data/resources across the deserialization process of multiple objects. Objects in meta must be class instances, not js objects. (like Material, Texture, Object3D etc)

    • isThis: boolean = false

      true if called from inside the deserialization function, like custom fromJSON

    Returns any

  • Serialize an object

    Parameters

    • obj: any

      object to serialize

    • Optional meta: Record<string, Record<string, any>>

      Optional object to store common meta-data/resources across the serialization process of multiple objects

    • isThis: boolean = false

      true if called from inside the serialization function, like custom toJSON.

    Returns any

Generated using TypeDoc