json

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalWithCustomFields

func MarshalWithCustomFields(v interface{}, cf map[string]interface{}) ([]byte, error)

MarshalWithCustomFields marshals value merged with custom fields defined in the map into JSON bytes.

func MergeCustomFields

func MergeCustomFields(v interface{}, cf map[string]interface{}) (map[string]interface{}, error)

MergeCustomFields converts value to the JSON-like map and merges it with custom fields map cf.

func ToMap

func ToMap(v interface{}) (map[string]interface{}, error)

ToMap convert object, string or bytes to json object represented by map.

func ToMaps

func ToMaps(v []interface{}) ([]map[string]interface{}, error)

ToMaps convert array to array of json objects.

func UnmarshalWithCustomFields

func UnmarshalWithCustomFields(data []byte, v interface{}, cf map[string]interface{}) error

UnmarshalWithCustomFields unmarshals JSON into value v and puts all JSON fields which do not belong to value into custom fields map cf.

Types

This section is empty.

Jump to

Keyboard shortcuts

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