Versions in this module Expand all Collapse all v0 v0.19.4 Nov 1, 2026 Changes in this version + const DefaultJSONText + var ErrJSONExpectedArray = errors.New("serializer json: expected array") + var ErrJSONExpectedArrayNext = errors.New("serializer json: expected ',' or ']' after array item") + var ErrJSONExpectedObject = errors.New("serializer json: expected object") + var ErrJSONExpectedObjectKeySeparator = errors.New("serializer json: expected ':' after object key") + var ErrJSONExpectedObjectNext = errors.New("serializer json: expected ',' or '}' after object value") + var ErrJSONInvalidUnknownFieldValue = errors.New("serializer json: invalid unknown field value") + var ErrJSONMapKeyUnsupported = errors.New("serializer json: proto-aware map only supports string keys") + var ErrJSONNilTarget = errors.New("serializer json: nil target") + var ErrJSONUnexpectedEndObject = errors.New("serializer json: unexpected end of object") + func FromJSON[T any](jsonStr string) T + func IsJSONExpectedArrayError(err error) bool + func IsJSONExpectedArrayNextError(err error) bool + func IsJSONExpectedObjectError(err error) bool + func IsJSONExpectedObjectKeySeparatorError(err error) bool + func IsJSONExpectedObjectNextError(err error) bool + func IsJSONInvalidUnknownFieldValueError(err error) bool + func IsJSONMapKeyUnsupportedError(err error) bool + func IsJSONNilTargetError(err error) bool + func IsJSONUnexpectedEndObjectError(err error) bool + func JSONMarshal[T any](value T) ([]byte, error) + func JSONUnmarshal[T any](data []byte, target *T) error + func LenientProtoJSONUnmarshal(data []byte, msg proto.Message) error + func NewJSONArrayTooLongError(items int, capacity int) error + func NewJSONExpectedArrayError() error + func NewJSONExpectedArrayNextError() error + func NewJSONExpectedObjectError() error + func NewJSONExpectedObjectKeySeparatorError() error + func NewJSONExpectedObjectNextError() error + func NewJSONFieldError(name string, err error) error + func NewJSONInvalidUnknownFieldValueError() error + func NewJSONItemError(index int, err error) error + func NewJSONKeyError(key string, err error) error + func NewJSONMapKeyUnsupportedError(keyType string) error + func NewJSONNilTargetError() error + func NewJSONUnexpectedEndObjectError() error + func NormalizeJSONDefault(defaultValue ...string) string + func NormalizeJSONText(value string, defaultValue ...string) string + func ProtoJSONMarshal(m interface{}) (string, error) + func ProtoJSONUnmarshal(a, b interface{}) error + func ToJSON[T any](v T) string + type BenchmarkResult struct + Compression CompressionType + DataSize int + DecodeTime time.Duration + EncodeTime time.Duration + Iterations int + Type SerializeType + func (r *BenchmarkResult) String() string + type CompressionType byte + const CompressionGzip + const CompressionNone + const CompressionZlib + const CompressionZstd + type LenientProtoJSONOptions struct + AllowPartial bool + DiscardUnknown bool + func (o LenientProtoJSONOptions) ToProtojsonOptions() protojson.UnmarshalOptions + func (o LenientProtoJSONOptions) Unmarshal(data []byte, msg proto.Message) error + type SerializeType byte + const TypeGob + const TypeJSON + const TypeMsgpack + const TypeProtobuf + type Serializer struct + func NewCompact[T any]() *Serializer[T] + func NewFast[T any]() *Serializer[T] + func NewGob[T any]() *Serializer[T] + func NewJSON[T any]() *Serializer[T] + func NewUltraCompact[T any]() *Serializer[T] + func NewZlibCompact[T any]() *Serializer[T] + func New[T any]() *Serializer[T] + func (s *Serializer[T]) Benchmark(obj T, iterations int) (*BenchmarkResult, error) + func (s *Serializer[T]) Decode(data []byte) (T, error) + func (s *Serializer[T]) DecodeFromString(encoded string) (T, error) + func (s *Serializer[T]) Encode(obj T) ([]byte, error) + func (s *Serializer[T]) EncodeToString(obj T) (string, error) + func (s *Serializer[T]) GetStats(obj T) (*Stats, error) + func (s *Serializer[T]) WithBase64(enable bool) *Serializer[T] + func (s *Serializer[T]) WithCompression(cType CompressionType) *Serializer[T] + func (s *Serializer[T]) WithCustomDecoder(decoder func([]byte) (T, error)) *Serializer[T] + func (s *Serializer[T]) WithCustomEncoder(encoder func(T) ([]byte, error)) *Serializer[T] + func (s *Serializer[T]) WithType(sType SerializeType) *Serializer[T] + type Stats struct + Base64 bool + Compression CompressionType + CompressionRatio float64 + CurrentSize int + GobSize int + JSONSize int + SpaceSaved int + SpaceSavedPercent float64 + Type SerializeType