Documentation
¶
Overview ¶
Package json loads JSON configuration from bytes, files, or URLs into maps and structs, with optional key normalization and multi-source merging.
Index ¶
- type Codec
- type Option
- func WithBytes(b []byte) Option
- func WithDecodeHook(h mapstructure.DecodeHookFunc) Option
- func WithFile(path string) Option
- func WithHTTPClient(client *http.Client) Option
- func WithHTTPHeader(k, v string) Option
- func WithKeyNormalizer(n keymap.Normalizer) Option
- func WithReader(r io.Reader) Option
- func WithSliceMerge(s merge.SliceStrategy) Option
- func WithTagName(name string) Option
- func WithTrim(enable bool) Option
- func WithURL(raw string) Option
- func WithWeaklyTyped(enable bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec loads JSON from multiple sources.
func (*Codec) UnmarshalContext ¶
UnmarshalContext decodes merged JSON into dst.
type Option ¶
type Option func(*Codec)
Option configures a Codec.
func WithDecodeHook ¶
func WithDecodeHook(h mapstructure.DecodeHookFunc) Option
WithDecodeHook appends a decode hook.
func WithHTTPClient ¶
WithHTTPClient sets the client for subsequent WithURL sources.
func WithHTTPHeader ¶
WithHTTPHeader adds a header for subsequent WithURL sources.
func WithKeyNormalizer ¶
func WithKeyNormalizer(n keymap.Normalizer) Option
WithKeyNormalizer sets key normalizer after merge (nil disables).
func WithSliceMerge ¶
func WithSliceMerge(s merge.SliceStrategy) Option
WithSliceMerge sets slice merge strategy across sources.
func WithWeaklyTyped ¶
WithWeaklyTyped toggles weak typing for struct decode.
Click to show internal directories.
Click to hide internal directories.