jsonx

package
v0.0.674 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllValidJSONKeys added in v0.0.367

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 added in v0.0.349

func ApplyJSONPatch(p json.RawMessage, object interface{}, denyPaths ...string) error

func EmbedSources added in v0.0.359

func EmbedSources(in json.RawMessage, opts ...OptionsModifier) (out json.RawMessage, err error)

func Flatten added in v0.0.83

func Flatten(raw json.RawMessage) map[string]interface{}

Flatten flattens a JSON object using dot notation.

func GetRequireValidKey added in v0.0.367

func GetRequireValidKey(t require.TestingT, original interface{}, raw []byte, key string) gjson.Result

func NewStrictDecoder

func NewStrictDecoder(b io.Reader) *json.Decoder

NewStrictDecoder is a shorthand for json.Decoder.DisallowUnknownFields

func TestMarshalJSONString added in v0.0.170

func TestMarshalJSONString(t *testing.T, i interface{}) string

func TestUnmarshalJSON added in v0.0.170

func TestUnmarshalJSON(t *testing.T, in []byte, i interface{})

Types

type OptionsModifier added in v0.0.359

type OptionsModifier func(*options)

func WithIgnoreKeys added in v0.0.359

func WithIgnoreKeys(keys ...string) OptionsModifier

func WithOnlySchemes added in v0.0.359

func WithOnlySchemes(scheme ...string) OptionsModifier

type Result added in v0.0.367

type Result struct {
	// contains filtered or unexported fields
}

func ParseEnsureKeys added in v0.0.367

func ParseEnsureKeys(original interface{}, raw []byte) *Result

ParseEnsureKeys returns a result that has the GetRequireValidKey function.

func (*Result) GetRequireValidKey added in v0.0.367

func (r *Result) GetRequireValidKey(t require.TestingT, key string) gjson.Result

GetRequireValidKey ensures that the key is valid before returning the result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL