Interfaces

@system-inc/base-foundation · 515c140 · 5 symbols

Deserializable interface defines a contract for objects that can be deserialized from JSON. This is useful for reconstructing objects from a structured JSON representation.

Members

  • deserialize(raw: JsonObject, options?: DeserializeOptions): this

    Hydrates the current instance from a raw JSON object.

View source ↗

Members

  • strict?: boolean

View source ↗

Serializable

interface

Serializable interface defines a contract for objects that can be serialized to a JSON object. This is useful for data transfer, storage, or any scenario where a structured representation of an object is needed.

Members

  • serialize(options?: SerializeOptions): T

    Serializes the current instance into a JSON compatible object.

View source ↗

Options for the @SerializableField decorator.

Members

  • defaultValue?: Json

    Optional default value for the field.

    This can be used to provide a default value when the field is not present in the serialized data.

  • description?: string

    Optional description for the field.

    This can be used for documentation purposes to explain the purpose of the field.

  • name?: string

    The name of the field in the serialized data.

    If not provided, the property name will be used. This is useful for cases where the serialized field name differs from the property name.

  • optional?: boolean

    Whether the field is optional.

    If true, the field is not required for serialization/deserialization. If false, the field must be present in the serialized data and will throw an error if missing.

    Defaults to false.

  • transformer?: Constructor<JsonValueTransformer<unknown>>

    Optional transformer for custom serialization/deserialization.

View source ↗

Members

  • onCycle?: "error" | "omit" | "null"

  • replacer?: (string | number)[] | null

  • space?: string | number

View source ↗

Interfaces • Documentation • Base