Skip to main content

Serializer

Data serialization, supports JSON and XML.

type Codec

type Codec interface {
// Encode encodes data to a byte stream
Encode(w io.Writer, v any, indent string) error
// Decode decodes data from a byte stream
Decode(r io.Reader, v any) error
}

Defines the serialization and deserialization interface for JSON and XML.

type JSONCodec

type JSONCodec struct{}

Implements the encoding and decoding interface for JSON.

type XMLCodec

type XMLCodec struct{}

Implements the encoding and decoding interface for XML.