Documentation ¶
Index ¶
- Variables
- func NewDecoder(b []byte) codec.Decoder
- func NewEncoder(indent string) (codec.Encoder, error)
- type Decoder
- type Encoder
- func (e *Encoder) Bytes() []byte
- func (e *Encoder) EndArray()
- func (e *Encoder) EndObject()
- func (e *Encoder) StartArray()
- func (e *Encoder) StartObject()
- func (e *Encoder) WriteBool(b bool)
- func (e *Encoder) WriteFloat(n float64, bitSize int)
- func (e *Encoder) WriteInt(n int64)
- func (e *Encoder) WriteName(s string) error
- func (e *Encoder) WriteNull()
- func (e *Encoder) WriteString(s string) error
- func (e *Encoder) WriteUint(n uint64)
Constants ¶
This section is empty.
Variables ¶
var ErrUnexpectedEOF = errors.New("%v", io.ErrUnexpectedEOF)
ErrUnexpectedEOF means that EOF was encountered in the middle of the input.
Functions ¶
func NewDecoder ¶
NewDecoder returns a Decoder to read the given []byte.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is a token-based JSON decoder.
func (*Decoder) Clone ¶
Clone returns a copy of the Decoder for use in reading ahead the next JSON object, array or other values without affecting current Decoder.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder provides methods to write out JSON constructs and values. The user is responsible for producing valid sequences of JSON constructs and values.
func (*Encoder) StartObject ¶
func (e *Encoder) StartObject()
StartObject writes out the '{' symbol.
func (*Encoder) WriteFloat ¶
WriteFloat writes out the given float and bitSize in JSON number value.
func (*Encoder) WriteName ¶
WriteName writes out the given string in JSON string value and the name separator ':'. Returns error if input string contains invalid UTF-8, which should not be likely as protobuf field names should be valid.
func (*Encoder) WriteString ¶
WriteString writes out the given string in JSON string value. Returns error if input string contains invalid UTF-8.