Documentation ¶
Overview ¶
Package json allows for different implementations of JSON serializing, as well as extra optional types needed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeStream ¶
DecodeStream uses the default driver.
func EncodeStream ¶
EncodeStream uses the default driver.
Types ¶
type AlwaysString ¶
type AlwaysString string
AlwaysString would always unmarshal into a string, from any JSON type. Quotes will be stripped.
func (AlwaysString) Int ¶
func (m AlwaysString) Int() (int, error)
func (*AlwaysString) UnmarshalJSON ¶
func (m *AlwaysString) UnmarshalJSON(data []byte) error
type DefaultDriver ¶
type DefaultDriver struct{}
func (DefaultDriver) DecodeStream ¶
func (d DefaultDriver) DecodeStream(r io.Reader, v interface{}) error
func (DefaultDriver) EncodeStream ¶
func (d DefaultDriver) EncodeStream(w io.Writer, v interface{}) error
func (DefaultDriver) Marshal ¶
func (d DefaultDriver) Marshal(v interface{}) ([]byte, error)
func (DefaultDriver) Unmarshal ¶
func (d DefaultDriver) Unmarshal(data []byte, v interface{}) error
type Driver ¶
type Driver interface { Marshal(v interface{}) ([]byte, error) Unmarshal(data []byte, v interface{}) error DecodeStream(r io.Reader, v interface{}) error EncodeStream(w io.Writer, v interface{}) error }
var Default Driver = DefaultDriver{}
Default is the default JSON driver, which uses encoding/json.
type Raw ¶
type Raw []byte
Raw is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding. It's taken from encoding/json.
func (Raw) MarshalJSON ¶
Raw returns m as the JSON encoding of m.
func (*Raw) UnmarshalJSON ¶
func (Raw) UnmarshalTo ¶
type Unmarshaler ¶
Click to show internal directories.
Click to hide internal directories.