Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConverterFactory ¶
type ConverterFactory func() Converter
ConverterFactory creates a custom type converter for serialization.
type NamingStrategy ¶
type NamingStrategy int
NamingStrategy controls how struct field names are transformed during serialization.
const ( // PascalCase leaves names as-is (Go default). PascalCase NamingStrategy = iota // CamelCase converts to lowerCamelCase. CamelCase // SnakeCase converts to snake_case. SnakeCase )
type Option ¶
type Option func(*Policy)
Option configures a Policy.
func WithCustomType ¶
func WithCustomType(typ reflect.Type, factory ConverterFactory) Option
WithCustomType registers a custom converter for a specific type.
func WithIgnoreNil ¶
func WithIgnoreNil() Option
WithIgnoreNil skips nil pointers during marshaling.
func WithIgnoreZero ¶
func WithIgnoreZero() Option
WithIgnoreZero skips zero values during marshaling.
func WithTagName ¶
WithTagName sets the struct tag used for field names (default: "json").
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy defines serialization behavior including naming and custom type handling.
func (*Policy) MarshalToString ¶
MarshalToString serializes v to a JSON string.
Click to show internal directories.
Click to hide internal directories.