go: github.com/json-iterator/go Index | Files | Directories

package jsoniter

import "github.com/json-iterator/go"


Package Files

feature_adapter.go feature_any.go feature_iter.go feature_iter_array.go feature_iter_float.go feature_iter_int.go feature_iter_object.go feature_iter_skip.go feature_iter_string.go feature_reflect.go feature_reflect_array.go feature_reflect_native.go feature_reflect_object.go feature_stream.go feature_stream_float.go feature_stream_int.go


var DECODERS unsafe.Pointer
var DIGITS []uint32
var ENCODERS unsafe.Pointer
var POW10 []uint64

func CleanDecoders Uses

func CleanDecoders()

CleanDecoders cleans decoders registered

func Marshal Uses

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

func MarshalToString Uses

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

func RegisterExtension Uses

func RegisterExtension(extension ExtensionFunc)

RegisterExtension can register a custom extension

func RegisterFieldDecoder Uses

func RegisterFieldDecoder(typ string, field string, fun DecoderFunc)

RegisterFieldDecoder can register a type for json field

func RegisterTypeDecoder Uses

func RegisterTypeDecoder(typ string, fun DecoderFunc)

RegisterTypeDecoder can register a type for json object

func Unmarshal Uses

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

Unmarshal adapts to json/encoding APIs

func UnmarshalFromString Uses

func UnmarshalFromString(str string, v interface{}) error

type Any Uses

type Any struct {
    Error        error
    LastAccessed interface{}
    // contains filtered or unexported fields

Any API is for maximum flexibility

func MakeAny Uses

func MakeAny(val interface{}) *Any

MakeAny creates Any instance

func (*Any) Get Uses

func (any *Any) Get(keys ...interface{}) interface{}

Get extracts a json object from Any

func (*Any) GetValueType Uses

func (any *Any) GetValueType(keys ...interface{}) ValueType

GetValueType gets type of a value

func (*Any) IsNil Uses

func (any *Any) IsNil(keys ...interface{}) bool

IsNil judges whether a json object is nil

func (*Any) ToBool Uses

func (any *Any) ToBool(keys ...interface{}) bool

ToBool converts a json object to Bool

func (*Any) ToFloat32 Uses

func (any *Any) ToFloat32(keys ...interface{}) float32

ToFloat32 converts a json object to Float32

func (*Any) ToFloat64 Uses

func (any *Any) ToFloat64(keys ...interface{}) float64

ToFloat64 converts a json object to Float64

func (*Any) ToInt Uses

func (any *Any) ToInt(keys ...interface{}) int

ToInt converts a json object to Int

func (*Any) ToInt16 Uses

func (any *Any) ToInt16(keys ...interface{}) int16

ToInt16 converts a json object to Int16

func (*Any) ToInt32 Uses

func (any *Any) ToInt32(keys ...interface{}) int32

ToInt32 converts a json object to Int32

func (*Any) ToInt64 Uses

func (any *Any) ToInt64(keys ...interface{}) int64

ToInt64 converts a json object to Int64

func (*Any) ToInt8 Uses

func (any *Any) ToInt8(keys ...interface{}) int8

ToInt8 converts a json object to Int8

func (*Any) ToString Uses

func (any *Any) ToString(keys ...interface{}) string

ToString converts a json object to string

func (*Any) ToUint Uses

func (any *Any) ToUint(keys ...interface{}) uint

ToUint converts a json object to Uint

func (*Any) ToUint16 Uses

func (any *Any) ToUint16(keys ...interface{}) uint16

ToUint16 converts a json object to Uint16

func (*Any) ToUint32 Uses

func (any *Any) ToUint32(keys ...interface{}) uint32

ToUint32 converts a json object to Uint32

func (*Any) ToUint64 Uses

func (any *Any) ToUint64(keys ...interface{}) uint64

ToUint64 converts a json object to Uint64

func (*Any) ToUint8 Uses

func (any *Any) ToUint8(keys ...interface{}) uint8

ToUint8 converts a json object to Uint8

type Decoder Uses

type Decoder interface {
    // contains filtered or unexported methods

type DecoderFunc Uses

type DecoderFunc func(ptr unsafe.Pointer, iter *Iterator)

type Encoder Uses

type Encoder interface {
    // contains filtered or unexported methods

type ExtensionFunc Uses

type ExtensionFunc func(typ reflect.Type, field *reflect.StructField) ([]string, DecoderFunc)

type Iterator Uses

type Iterator struct {
    Error error
    // contains filtered or unexported fields

Iterator is a fast and flexible JSON parser

func NewIterator Uses

func NewIterator() *Iterator

Create creates an empty Iterator instance

func Parse Uses

func Parse(reader io.Reader, bufSize int) *Iterator

Parse parses a json buffer in io.Reader into an Iterator instance

func ParseBytes Uses

func ParseBytes(input []byte) *Iterator

ParseBytes parses a json byte slice into an Iterator instance

func ParseString Uses

func ParseString(input string) *Iterator

ParseString parses a json string into an Iterator instance

func (*Iterator) CurrentBuffer Uses

func (iter *Iterator) CurrentBuffer() string

CurrentBuffer gets current buffer as string

func (*Iterator) Read Uses

func (iter *Iterator) Read() interface{}

func (*Iterator) ReadAny Uses

func (iter *Iterator) ReadAny() (ret *Any)

ReadAny converts a json object in a Iterator instance to Any

func (*Iterator) ReadArray Uses

func (iter *Iterator) ReadArray() (ret bool)

func (*Iterator) ReadArrayCB Uses

func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool)

func (*Iterator) ReadBase64 Uses

func (iter *Iterator) ReadBase64() (ret []byte)

ReadBase64 reads a json object as Base64 in byte slice

func (*Iterator) ReadBool Uses

func (iter *Iterator) ReadBool() (ret bool)

ReadBool reads a json object as Bool

func (*Iterator) ReadFloat32 Uses

func (iter *Iterator) ReadFloat32() (ret float32)

func (*Iterator) ReadFloat64 Uses

func (iter *Iterator) ReadFloat64() (ret float64)

func (*Iterator) ReadInt Uses

func (iter *Iterator) ReadInt() int

func (*Iterator) ReadInt16 Uses

func (iter *Iterator) ReadInt16() (ret int16)

func (*Iterator) ReadInt32 Uses

func (iter *Iterator) ReadInt32() (ret int32)

func (*Iterator) ReadInt64 Uses

func (iter *Iterator) ReadInt64() (ret int64)

func (*Iterator) ReadInt8 Uses

func (iter *Iterator) ReadInt8() (ret int8)

func (*Iterator) ReadNil Uses

func (iter *Iterator) ReadNil() (ret bool)

ReadNil reads a json object as nil and returns whether it's a nil or not

func (*Iterator) ReadObject Uses

func (iter *Iterator) ReadObject() (ret string)

func (*Iterator) ReadObjectCB Uses

func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool

func (*Iterator) ReadString Uses

func (iter *Iterator) ReadString() (ret string)

TODO: avoid append

func (*Iterator) ReadStringAsSlice Uses

func (iter *Iterator) ReadStringAsSlice() (ret []byte)

func (*Iterator) ReadUint Uses

func (iter *Iterator) ReadUint() uint

func (*Iterator) ReadUint16 Uses

func (iter *Iterator) ReadUint16() (ret uint16)

func (*Iterator) ReadUint32 Uses

func (iter *Iterator) ReadUint32() (ret uint32)

func (*Iterator) ReadUint64 Uses

func (iter *Iterator) ReadUint64() uint64

func (*Iterator) ReadUint8 Uses

func (iter *Iterator) ReadUint8() (ret uint8)

func (*Iterator) ReadVal Uses

func (iter *Iterator) ReadVal(obj interface{})

Read converts an Iterator instance into go interface, same as json.Unmarshal

func (*Iterator) Reset Uses

func (iter *Iterator) Reset(reader io.Reader) *Iterator

Reset can reset an Iterator instance for another json buffer in io.Reader

func (*Iterator) ResetBytes Uses

func (iter *Iterator) ResetBytes(input []byte) *Iterator

ResetBytes can reset an Iterator instance for another json byte slice

func (*Iterator) Skip Uses

func (iter *Iterator) Skip()

Skip skips a json object and positions to relatively the next json object

func (*Iterator) WhatIsNext Uses

func (iter *Iterator) WhatIsNext() ValueType

WhatIsNext gets ValueType of relatively next json object

type Stream Uses

type Stream struct {
    Error error

    IndentionStep int
    // contains filtered or unexported fields

func NewStream Uses

func NewStream(out io.Writer, bufSize int) *Stream

func (*Stream) Available Uses

func (b *Stream) Available() int

Available returns how many bytes are unused in the buffer.

func (*Stream) Buffered Uses

func (b *Stream) Buffered() int

Buffered returns the number of bytes that have been written into the current buffer.

func (*Stream) Flush Uses

func (b *Stream) Flush() error

Flush writes any buffered data to the underlying io.Writer.

func (*Stream) Write Uses

func (b *Stream) Write(p []byte) (nn int, err error)

Write writes the contents of p into the buffer. It returns the number of bytes written. If nn < len(p), it also returns an error explaining why the write is short.

func (*Stream) WriteArrayEnd Uses

func (stream *Stream) WriteArrayEnd()

func (*Stream) WriteArrayStart Uses

func (stream *Stream) WriteArrayStart()

func (*Stream) WriteBool Uses

func (stream *Stream) WriteBool(val bool)

func (*Stream) WriteEmptyArray Uses

func (stream *Stream) WriteEmptyArray()

func (*Stream) WriteEmptyObject Uses

func (stream *Stream) WriteEmptyObject()

func (*Stream) WriteFalse Uses

func (stream *Stream) WriteFalse()

func (*Stream) WriteFloat32 Uses

func (stream *Stream) WriteFloat32(val float32)

func (*Stream) WriteFloat64 Uses

func (stream *Stream) WriteFloat64(val float64)

func (*Stream) WriteInt Uses

func (stream *Stream) WriteInt(val int)

func (*Stream) WriteInt16 Uses

func (stream *Stream) WriteInt16(nval int16)

func (*Stream) WriteInt32 Uses

func (stream *Stream) WriteInt32(nval int32)

func (*Stream) WriteInt64 Uses

func (stream *Stream) WriteInt64(nval int64)

func (*Stream) WriteInt8 Uses

func (stream *Stream) WriteInt8(nval int8)

func (*Stream) WriteMore Uses

func (stream *Stream) WriteMore()

func (*Stream) WriteNil Uses

func (stream *Stream) WriteNil()

func (*Stream) WriteObjectEnd Uses

func (stream *Stream) WriteObjectEnd()

func (*Stream) WriteObjectField Uses

func (stream *Stream) WriteObjectField(field string)

func (*Stream) WriteObjectStart Uses

func (stream *Stream) WriteObjectStart()

func (*Stream) WriteRaw Uses

func (b *Stream) WriteRaw(s string)

func (*Stream) WriteString Uses

func (stream *Stream) WriteString(s string)

func (*Stream) WriteTrue Uses

func (stream *Stream) WriteTrue()

func (*Stream) WriteUint Uses

func (stream *Stream) WriteUint(val uint)

func (*Stream) WriteUint16 Uses

func (stream *Stream) WriteUint16(val uint16)

func (*Stream) WriteUint32 Uses

func (stream *Stream) WriteUint32(val uint32)

func (*Stream) WriteUint64 Uses

func (stream *Stream) WriteUint64(val uint64)

func (*Stream) WriteUint8 Uses

func (stream *Stream) WriteUint8(val uint8)

func (*Stream) WriteVal Uses

func (stream *Stream) WriteVal(val interface{})

type ValueType Uses

type ValueType int
const (
    Invalid ValueType = iota



Package jsoniter imports 10 packages (graph). Updated 2017-01-23. Refresh now. Tools for package owners.