package jsonfields
Import Path
github.com/goccy/go-json/internal/jsonfields (on go.dev)
Dependency Relation
imports 10 packages, and imported by 2 packages
Involved Source Files
Package jsonfields finds the JSON object members of a Go struct by the rules of encoding/json/v2: the fields
which a value of the struct is marshaled to and unmarshaled from, with the options of their `json` tags.
A Go struct is a list of fields found by a breadth-first search over its fields and the fields of the structs
embedded in it. A field hides the fields of the same name deeper than it, and of two fields at the same depth
the one whose name is given by its tag. An error in the definition of the struct is reported when a value of it
is marshaled or unmarshaled, not when the type is seen: an empty map of it is still {}.
Package-Level Type Names (total 5)
Casing is how the name of a field is matched when unmarshaling, by its `case` option.
const CaseIgnore
const CaseStrict
Field is a JSON object member of a struct.
HasIsZero is whether the type of the field, or the pointer to it, has the IsZero method, which decides
whether the field is omitted by omitzero.
ID is the place of the field in the breadth-first order of the fields.
Index is the index of the field by reflect.Type.FieldByIndex: the fields of the embedded structs on the
way to it, and the field.
Options Options
Options.Casing Casing
Options.Embed bool
Options.Format string
// whether the tag gives the name
// the JSON object name
Options.OmitEmpty bool
Options.OmitZero bool
// Name as a JSON string
Options.String bool
Type reflect.Type
Fields are the JSON object members of a struct.
Err is the first error of the definition of the struct, or nil.
Fallback is the embedded field of a map or of jsontext.Value which holds the members of no other field, or
nil.
FormatErr is the error of the first field with the `format` option, which encoding/json/v2 doesn't
support, or nil.
List is the fields in the depth-first order of their indexes, which is the order they are marshaled in.
func Of(t reflect.Type) *Fields
Package-Level Functions (total 2)
FoldName returns the name of which the names that case:ignore matches are the same: the case is folded, and '_'
and '-' are removed.
Of returns the JSON object members of the struct type t.
Package-Level Variables (total 2)
MethodTypes are the interfaces of the methods of marshaling and unmarshaling: a type which has one of them
can't be embedded.
RawValueType is jsontext.Value, which is an embedded fallback.
Package-Level Constants (total 2)
const CaseIgnore Casing = 1 // case:ignore, which ignores the case, '-' and '_' const CaseStrict Casing = 2 // case:strict
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |