package module
Version: v1.2.0 Latest Latest

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 1 Imported by: 0



A go util package to assist working with JSON that has been unmarshaled into map[string]interface{} and []interface{} types.

License: MIT




This section is empty.


This section is empty.


This section is empty.


type Key added in v1.2.0

type Key struct {
	// contains filtered or unexported fields

Key represents either the index of an array (int) or the key in a map (string).

func (Key) Array added in v1.2.0

func (k Key) Array() int

func (Key) IsArray added in v1.2.0

func (k Key) IsArray() bool

func (Key) IsMap added in v1.2.0

func (k Key) IsMap() bool

func (Key) Map added in v1.2.0

func (k Key) Map() string

type MapTraverser

type MapTraverser struct {
	// contains filtered or unexported fields

func NewMapTraverser

func NewMapTraverser(m map[string]interface{}) MapTraverser

func (MapTraverser) Child

func (t MapTraverser) Child(keys ...string) MapTraverser

func (MapTraverser) Delete

func (t MapTraverser) Delete(key string) bool

func (MapTraverser) FindAllWithKey

func (t MapTraverser) FindAllWithKey(key string) MapTraversers

func (MapTraverser) Set

func (t MapTraverser) Set(key string, i interface{}) bool

func (MapTraverser) SetAll added in v1.2.0

func (t MapTraverser) SetAll(fn SetFunc) int

SetAll traverses all []interface{} and map[string]interface{} types and calls the fn (SetFunc) for each key/value pair. If the SetFunc for a given key/value pair returns bool(true) as its 2nd return value, then said value will be updated to whatever SetFunc returned as the interface{}.

func (MapTraverser) Value

func (t MapTraverser) Value(key string, i interface{}) (interface{}, bool)

type MapTraversers

type MapTraversers []MapTraverser

type SetFunc added in v1.2.0

type SetFunc func(k Key, value interface{}) (interface{}, bool)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL