Versions in this module Expand all Collapse all v0 v0.9.0 Mar 24, 2026 Changes in this version + func Marshal(value interface{}, opts ...Option) ([]byte, error) + func MarshalContext(ctx context.Context, value interface{}, opts ...Option) ([]byte, error) + func Unmarshal(data []byte, dest interface{}, opts ...Option) error + func UnmarshalContext(ctx context.Context, data []byte, dest interface{}, opts ...Option) error + type Codec interface + AddArray func(MarshalerArray) + AddBool func(bool) + AddFloat32 func(float32) + AddFloat64 func(float64) + AddInt func(int) + AddInt16 func(int16) + AddInt32 func(int32) + AddInt64 func(int64) + AddInt8 func(int8) + AddInterface func(interface{}) error + AddNull func() + AddObject func(MarshalerObject) + AddString func(string) + AddUint func(uint) + AddUint16 func(uint16) + AddUint32 func(uint32) + AddUint64 func(uint64) + AddUint8 func(uint8) + Array func(UnmarshalerArray) error + Bool func(*bool) error + Float32 func(*float32) error + Float64 func(*float64) error + Int func(*int) error + Int16 func(*int16) error + Int32 func(*int32) error + Int64 func(*int64) error + Int8 func(*int8) error + Interface func(*interface{}) error + Object func(UnmarshalerObject) error + String func(*string) error + Uint func(*uint) error + Uint16 func(*uint16) error + Uint32 func(*uint32) error + Uint64 func(*uint64) error + Uint8 func(*uint8) error + type Decoder interface + Array func(UnmarshalerJSONArray) error + Bool func(*bool) error + Float32 func(*float32) error + Float64 func(*float64) error + Int func(*int) error + Int16 func(*int16) error + Int32 func(*int32) error + Int64 func(*int64) error + Int8 func(*int8) error + Interface func(*interface{}) error + Object func(UnmarshalerJSONObject) error + String func(*string) error + Uint func(*uint) error + Uint16 func(*uint16) error + Uint32 func(*uint32) error + Uint64 func(*uint64) error + Uint8 func(*uint8) error + type DuplicateKeyPolicy int + const ErrorOnDuplicate + const LastWins + type FieldExcluder interface + Exclude func(path, fieldName string) bool + type MalformedPolicy int + const FailFast + const Tolerant + type MarshalInterceptor func() ([]byte, error) + type MarshalInterceptors map[string]MarshalInterceptor + type MarshalSession struct + Buffer *bytes.Buffer + Interceptors MarshalInterceptors + Options Options + func NewMarshalSession(options Options) *MarshalSession + func (s *MarshalSession) PathRef() PathRef + func (s *MarshalSession) PopPath() + func (s *MarshalSession) PushField(name string) + func (s *MarshalSession) PushIndex(index int) + func (s *MarshalSession) Release() + type MarshalerArray interface + IsNil func() bool + MarshalArray func(context.Context, Codec) + type MarshalerObject interface + IsNil func() bool + MarshalObject func(context.Context, Codec) + type Mode int + const ModeCompat + const ModeStrict + type NameTransformer interface + Transform func(path, fieldName string) string + type NilSlicePolicy int + const NilSliceAsEmptyArray + const NilSliceAsNull + type NullPolicy int + const CompatNulls + const StrictNulls + type NumberPolicy int + const CoerceNumbers + const ExactNumbers + type Option interface + func WithCaseFormat(caseFormat text.CaseFormat) Option + func WithContext(ctx context.Context) Option + func WithDebugPathSink(sink func(PathRef)) Option + func WithDuplicateKeyPolicy(policy DuplicateKeyPolicy) Option + func WithFieldExcluder(excluder FieldExcluder) Option + func WithFieldUnmarshalHook(...) Option + func WithFormatTag(tag *format.Tag) Option + func WithMalformedPolicy(policy MalformedPolicy) Option + func WithMode(mode Mode) Option + func WithNameTransformer(transformer NameTransformer) Option + func WithNilSlicePolicy(policy NilSlicePolicy) Option + func WithNullPolicy(policy NullPolicy) Option + func WithNumberPolicy(policy NumberPolicy) Option + func WithOmitEmpty(enabled bool) Option + func WithPathFieldExcluder(excluder PathFieldExcluder) Option + func WithPathNameTransformer(transformer PathNameTransformer) Option + func WithPathTracking(mode PathTrackingMode) Option + func WithPathUnmarshalHook(...) Option + func WithScannerHooks(hooks ScannerHooks) Option + func WithUnknownFieldPolicy(policy UnknownFieldPolicy) Option + type Options struct + CaseFormat text.CaseFormat + Ctx context.Context + DebugPathSink func(PathRef) + DuplicateKeyPolicy DuplicateKeyPolicy + FieldExcluder FieldExcluder + FieldUnmarshalHook func(ctx context.Context, holder unsafe.Pointer, field string, value any) (any, error) + FormatTag *format.Tag + MalformedPolicy MalformedPolicy + Mode Mode + NameTransformer NameTransformer + NilSlicePolicy NilSlicePolicy + NullPolicy NullPolicy + NumberPolicy NumberPolicy + OmitEmpty bool + PathExcluder PathFieldExcluder + PathName PathNameTransformer + PathTracking PathTrackingMode + PathUnmarshalHook func(ctx context.Context, holder unsafe.Pointer, path []string, field string, ...) (any, error) + TimeLayout string + UnknownFieldPolicy UnknownFieldPolicy + type PathFieldExcluder interface + ExcludePath func(path []string, fieldName string) bool + type PathNameTransformer interface + TransformPath func(path []string, fieldName string) string + type PathRef struct + func (p PathRef) At(i int) (PathSegment, bool) + func (p PathRef) Len() int + func (p PathRef) Segments() []PathSegment + type PathSegment struct + Field string + Index int + Kind SegmentKind + type PathTrackingMode int + const PathTrackingErrorsOnly + const PathTrackingFull + const PathTrackingOff + type ScannerHooks interface + FindQuoteOrEscape func(data []byte, pos int) (quotePos int, escapePos int) + FindStructural func(data []byte, pos int) int + SkipWhitespace func(data []byte, pos int) int + type SegmentKind int + const SegmentField + const SegmentIndex + type UnknownFieldPolicy int + const ErrorOnUnknown + const IgnoreUnknown + type UnmarshalInterceptor func(dst interface{}, codec Codec, options ...interface{}) error + type UnmarshalInterceptors map[string]UnmarshalInterceptor + type UnmarshalSession struct + Interceptors UnmarshalInterceptors + Options Options + func NewUnmarshalSession(options Options) *UnmarshalSession + func (s *UnmarshalSession) PathRef() PathRef + func (s *UnmarshalSession) PopPath() + func (s *UnmarshalSession) PushField(name string) + func (s *UnmarshalSession) PushIndex(index int) + type UnmarshalerArray interface + UnmarshalArray func(context.Context, Codec) error + type UnmarshalerJSONArray interface + UnmarshalJSONArray func(context.Context, Decoder) error + type UnmarshalerJSONObject interface + NKeys func() int + UnmarshalJSONObject func(context.Context, Decoder, string) error + type UnmarshalerObject interface + NKeys func() int + UnmarshalObject func(context.Context, Codec, string) error v0.6.1 Oct 30, 2024 Changes in this version + type Tag struct