json

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalAndSortJSON

func MarshalAndSortJSON(jsonValue interface{}) ([]byte, error)

MarshalAndSortJSON sorts alphabetically the json representation of an interface and returns its marshaled value.

func MustMarshalAndSortJSON

func MustMarshalAndSortJSON(jsonValue interface{}) []byte

MustMarshalAndSortJSON panics if MarshalAndSortJSON fails.

Types

type MarshalWrapper

type MarshalWrapper struct {
	Value interface{} `json:"value"`
	Type  string      `json:"type"`
}

MarshalWrapper wraps an interface value and its corresponding string type. It is useful to convert an interface field to unmarshal it back afterwards.

type UnmarshalWrapper

type UnmarshalWrapper struct {
	Value json.RawMessage `json:"value"`
	Type  string          `json:"type"`
}

UnmarshalWrapper wraps a json raw message and its corresponding string type. It is useful to delay the unmarshal step once a concrete type can be determined by its string type.

Jump to

Keyboard shortcuts

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