jsonutil

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsType

func AsType[T any](src interface{}) (*T, error)

AsType call json marshal and unmarshal to convert src to given target type

func CopyInto

func CopyInto(src interface{}, dest interface{}) error

CopyInto marshal the source object and unmarshal to destination object

func LookupPath

func LookupPath(obj any, path string) (any, error)

LookupPath lookup path for obj

func StrictUnmarshal

func StrictUnmarshal(bs []byte, dest interface{}) error

StrictUnmarshal unmarshal target structure and disallow unknown fields

Types

type Field

type Field struct {
	Label string
	Index *int64
}

Field if Index is not null, it points to an array index; otherwise a struct field

func ParseFields

func ParseFields(path string) (fields []Field, err error)

ParseFields extract fields from one path

Jump to

Keyboard shortcuts

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