jsonwalk

package
v0.0.0-...-b5a46b0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: MIT Imports: 5 Imported by: 0

README

jsonwalk: a library to recursively traverse JSON structures

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Object = &Type{internalType("object")}
	Array  = &Type{internalType("array")}
	String = &Type{internalType("string")}
	Number = &Type{internalType("number")}
	Bool   = &Type{internalType("bool")}
	Null   = &Type{internalType("null")}
)

Functions

func FieldName

func FieldName(path string) string

func Normalize

func Normalize(x interface{}) (interface{}, error)

Normalize JSON object so that it is (shallowly) one of the basic JSON types.

func Walk

func Walk(structure interface{}, callback Walker, opts ...Option) error

func WalkWithValues

func WalkWithValues(structure interface{}, callback ValueWalker, opts ...Option) (interface{}, error)

Types

type Option

type Option func(*options) error

func WithRootPath

func WithRootPath(s string) Option

func WithoutArrayIndices

func WithoutArrayIndices() Option

type Type

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

func TypeOf

func TypeOf(x interface{}) (*Type, error)

func (*Type) String

func (t *Type) String() string

type ValueWalker

type ValueWalker func(parentValue interface{}, path string, value interface{}) (interface{}, bool, error)

type Walker

type Walker func(path string, value interface{}) (bool, error)

Jump to

Keyboard shortcuts

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