json

package
v0.0.0-...-5a689ec Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPointerRequired = errors.New("pointer required")
)

Errors

View Source
var (
	ErrRawNil = errors.New("RawMessage cannot be nil pointer")
)

Errors

Functions

func Compact

func Compact(dst StringWriter, src []byte) error

func Indent

func Indent(dst StringWriter, src []byte, prefix, indent string) (err error)

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal encodes v into a byte slice, using the same rules as stdlib/json

func MarshalIndent

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

MarshalIndent is like Marshal, but applies the given indentation and prefix to the beginning of the line

func MarshalIndentString

func MarshalIndentString(v interface{}, prefix, indent string) (json string, err error)

MarshalIndentString is like MarshalIndent, but outputs a string

func MarshalString

func MarshalString(v interface{}) (string, error)

MarshalString encodes v into a byte slice, using the same rules as stdlib/json

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

func UnmarshalString

func UnmarshalString(data string, v interface{}) (err error)

Types

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(v interface{}) error

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}) error

type JSObject

type JSObject struct {
	*js.Object
}

type RawMessage

type RawMessage []byte

func (*RawMessage) MarshalJSON

func (r *RawMessage) MarshalJSON() ([]byte, error)

func (*RawMessage) UnmarshalJSON

func (r *RawMessage) UnmarshalJSON(data []byte) error

type StringWriter

type StringWriter interface {
	WriteString(string) (int, error)
}

Jump to

Keyboard shortcuts

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