Interfaces
@system-inc/base-foundation · 515c140 · 5 symbols
Deserializable
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):thisHydrates the current instance from a raw JSON object.
DeserializeOptions
Members
strict?:boolean
Serializable
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):TSerializes the current instance into a JSON compatible object.
SerializableFieldOptions
Options for the @SerializableField decorator.
Members
defaultValue?:JsonOptional 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?:stringOptional description for the field.
This can be used for documentation purposes to explain the purpose of the field.
name?:stringThe 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?:booleanWhether 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.
SerializeOptions
Members
onCycle?:"error" | "omit" | "null"replacer?:(string | number)[] | nullspace?:string | number