Documentation
¶
Overview ¶
Package jsonstruct derives the set of JSON fields for a Go struct type. It exposes the internal logic used by the encoding/json/v2 implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Index []int // index to the struct field according to [reflect.Type.FieldByIndex]
GoType reflect.Type // the Go type of the field
JSONName string // the JSON name of the field
StrictCase bool // whether `case:strict` is specified
IgnoreCase bool // whether `case:ignore` is specified
Inline bool // whether `inline` is specified
Unknown bool // whether `unknown` is specified
OmitZero bool // whether `omitzero` is specified
OmitEmpty bool // whether `omitempty` is specified
String bool // whether `string` is specified
Format string // the `format` string value
}
Field is a JSON serializable Go struct field.
type Fields ¶
type Fields struct {
// ByIndex a list of all JSON serializable fields
// in depth-first ordering.
ByIndex []Field
// ByName is a mapping of all JSON field names
// to an index into ByIndex.
ByName map[string]int
// InlinedFallback is the field used to store unknown fields.
// It is valid only if Field.Index is non-nil.
InlinedFallback Field
}
Fields the set of all JSON serializable fields in a Go struct field.
Click to show internal directories.
Click to hide internal directories.