jsonutil

package
v0.30.9 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EscapedTilde = "~0"
	EscapedSlash = "~1"
)

Variables

View Source
var (
	MarshalPrefix = ""
	MarshalIndent = "    "
)

Functions

func GetSubobjectBytes added in v0.0.5

func GetSubobjectBytes(data []byte, key string) ([]byte, error)

func JsonParserGetArrayIntOneOnly

func JsonParserGetArrayIntOneOnly(data []byte, key string) (int, error)

func JsonParserGetArrayString

func JsonParserGetArrayString(data []byte, key string) ([]string, error)

func JsonParserGetArrayStringOneOnly

func JsonParserGetArrayStringOneOnly(data []byte, key string) (string, error)

func MarshalBase64

func MarshalBase64(i interface{}) (string, error)

func MarshalSimple

func MarshalSimple(v interface{}, prefix, indent string) ([]byte, error)

func MustGetSubobjectBytes added in v0.0.5

func MustGetSubobjectBytes(data []byte, key string) []byte

func MustMarshal

func MustMarshal(i interface{}, embedError bool) []byte

func MustMarshalIndent

func MustMarshalIndent(i interface{}, prefix, indent string, embedError bool) []byte

func MustMarshalSimple

func MustMarshalSimple(v interface{}, prefix, indent string) []byte

func MustMarshalString

func MustMarshalString(i interface{}, embedError bool) string

func PointerCondense added in v0.0.24

func PointerCondense(s string) string

PointerCondense removes duplicate slashes.

func PointerSubEscapeAll added in v0.0.24

func PointerSubEscapeAll(format string, vars ...interface{}) string

PointerSubEscapeAll will substitute vars using `fmt.Sprintf()` All strings are escaped.

func PrettyPrint

func PrettyPrint(b []byte, prefix, indent string) []byte

PrettyPrint converts a JSON byte array into a prettified byte array.

func PrettyPrintReader added in v0.0.15

func PrettyPrintReader(r io.Reader, prefix, indent string) ([]byte, error)

func PropertyNameEscape added in v0.0.15

func PropertyNameEscape(s string) string

PropertyNameEscape escapes JSON property name using JSON Schema rules.

func PropertyNameUnescape added in v0.0.15

func PropertyNameUnescape(s string) string

PropertyNameUnescape unescapes JSON property name using JSON Schema rules.

func ReadFile

func ReadFile(filename string, v interface{}) ([]byte, error)

func UnmarshalReader added in v0.0.15

func UnmarshalReader(r io.Reader, iface interface{}) ([]byte, error)

func WriteFile added in v0.28.2

func WriteFile(filename string, v interface{}, prefix, indent string, perm fs.FileMode) error

Types

type Bool added in v0.0.12

type Bool bool

Bool implements a tolerant reader for `bool` type.

func (*Bool) UnmarshalJSON added in v0.0.12

func (this *Bool) UnmarshalJSON(b []byte) error

func (*Bool) Value added in v0.0.12

func (this *Bool) Value() bool

type Int64 added in v0.0.12

type Int64 int64

Int64 implements a tolerant reader for `int64` type.

func (*Int64) UnmarshalJSON added in v0.0.12

func (this *Int64) UnmarshalJSON(b []byte) error

func (*Int64) Value added in v0.0.12

func (this *Int64) Value() int64

Jump to

Keyboard shortcuts

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