Documentation ¶
Overview ¶
Package jsonutil provides utilities for parsing JSON files.
Index ¶
- func Decode(r io.Reader, v interface{}) error
- func DecodeAllowUnknownFields(r io.Reader, v interface{}) error
- func DecodeFile(filename string, v interface{}) error
- func DecodeFileAllowUnknownFields(filename string, v interface{}) error
- func DecodeMozLz4(r io.Reader, v interface{}) error
- func DecodeMozLz4File(filename string, v interface{}) error
- func DecompressMozLz4(b []byte) ([]byte, error)
- func QuotedUnmarshal(data []byte, v encoding.TextUnmarshaler) error
- func UnmarshalMozLz4(b []byte, v interface{}) error
- type Base64
- type Hex
- type UnknownObj
- type UnknownType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes the result into data, requiring fields to match strictly and checking for trailing text. The reader is read to completion, even on error, so that HTTP response bodies are properly closed and connections can be reused.
func DecodeAllowUnknownFields ¶
DecodeAllowUnknownFields decodes the result into data, checking for trailing text. The reader is read to completion, even on error, so that HTTP response bodies are properly closed and connections can be reused.
func DecodeFile ¶
DecodeFile opens the given file and decodes the result into data, requiring fields to match strictly and checking for trailing text.
func DecodeFileAllowUnknownFields ¶
DecodeFileAllowUnknownFields opens the given file and decodes the result into data, checking for trailing text.
func DecodeMozLz4 ¶
func DecodeMozLz4File ¶
func DecompressMozLz4 ¶
func QuotedUnmarshal ¶
func QuotedUnmarshal(data []byte, v encoding.TextUnmarshaler) error
QuotedUnmarshal removes quotes then unmarshals the data. Escape sequences are not checked.
func UnmarshalMozLz4 ¶
Types ¶
type Base64 ¶
type Base64 []byte
Base64 is a byte slice that is formatted in json as a base64 string.
func (Base64) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Base64) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Base64) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Base64) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Hex ¶
type Hex []byte
Hex is a byte slice that is formatted in json as a hexadecimal string.
func (Hex) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Hex) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Hex) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Hex) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type UnknownObj ¶
type UnknownObj struct{}
UnknownObj represents a json object for which the full type information is not known. Any unmarshal of a value that is not null or {} will raise an error. This is to ensure no data loss until all types have been determined.
func (*UnknownObj) UnmarshalJSON ¶
func (u *UnknownObj) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. Any unmarshal of a value that is not null will raise an error. This is to ensure no data loss until all types have been determined.
type UnknownType ¶
type UnknownType struct{}
UnknownType represents a json value for which the full type information is not known. Any unmarshal of a value that is not null will raise an error. This is to ensure no data loss until all types have been determined.
func (*UnknownType) UnmarshalJSON ¶
func (u *UnknownType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface. Any unmarshal of a value that is not null will raise an error. This is to ensure no data loss until all types have been determined.