Documentation ¶
Index ¶
- func AllValidJSONKeys(s interface{}) (keys []string)
- func ApplyJSONPatch(p json.RawMessage, object interface{}, denyPaths ...string) error
- func EmbedSources(in json.RawMessage, opts ...OptionsModifier) (out json.RawMessage, err error)
- func Flatten(raw json.RawMessage) map[string]interface{}
- func GetRequireValidKey(t require.TestingT, original interface{}, raw []byte, key string) gjson.Result
- func NewStrictDecoder(b io.Reader) *json.Decoder
- func TestMarshalJSONString(t *testing.T, i interface{}) string
- func TestUnmarshalJSON(t *testing.T, in []byte, i interface{})
- type OptionsModifier
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllValidJSONKeys ¶
func AllValidJSONKeys(s interface{}) (keys []string)
AllValidJSONKeys returns all JSON keys from the struct or *struct type. It does not return keys from nested slices, but embedded/nested structs.
func ApplyJSONPatch ¶
func ApplyJSONPatch(p json.RawMessage, object interface{}, denyPaths ...string) error
func EmbedSources ¶
func EmbedSources(in json.RawMessage, opts ...OptionsModifier) (out json.RawMessage, err error)
func Flatten ¶
func Flatten(raw json.RawMessage) map[string]interface{}
Flatten flattens a JSON object using dot notation.
func GetRequireValidKey ¶
func NewStrictDecoder ¶
NewStrictDecoder is a shorthand for json.Decoder.DisallowUnknownFields
func TestMarshalJSONString ¶
func TestUnmarshalJSON ¶
Types ¶
type OptionsModifier ¶
type OptionsModifier func(*options)
func WithIgnoreKeys ¶
func WithIgnoreKeys(keys ...string) OptionsModifier
func WithOnlySchemes ¶
func WithOnlySchemes(scheme ...string) OptionsModifier
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func ParseEnsureKeys ¶
ParseEnsureKeys returns a result that has the GetRequireValidKey function.
Click to show internal directories.
Click to hide internal directories.