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_any_array.go feature_any_bool.go feature_any_float.go feature_any_int32.go feature_any_int64.go feature_any_invalid.go feature_any_nil.go feature_any_object.go feature_any_string.go feature_any_uint32.go feature_any_uint64.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 RegisterFieldEncoder Uses

func RegisterFieldEncoder(typ string, field string, fun EncoderFunc)

func RegisterTypeDecoder Uses

func RegisterTypeDecoder(typ string, fun DecoderFunc)

RegisterTypeDecoder can register a type for json object

func RegisterTypeEncoder Uses

func RegisterTypeEncoder(typ string, fun EncoderFunc)

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

func WriteToStream Uses

func WriteToStream(val interface{}, stream *Stream, encoder Encoder)

type Any Uses

type Any interface {
    LastError() error
    ValueType() ValueType
    ToBool() bool
    ToInt() int
    ToInt32() int32
    ToInt64() int64
    ToUint() uint
    ToUint32() uint32
    ToUint64() uint64
    ToFloat32() float32
    ToFloat64() float64
    ToString() string
    Get(path ...interface{}) Any
    Size() int
    Keys() []string
    IterateObject() (func() (string, Any, bool), bool)
    IterateArray() (func() (Any, bool), bool)
    GetArray() []Any
    SetArray(newList []Any) bool
    GetObject() map[string]Any
    SetObject(map[string]Any) bool
    GetInterface() interface{}
    WriteTo(stream *Stream)
    Parse() *Iterator

func UnmarshalAny Uses

func UnmarshalAny(data []byte) (Any, error)

func UnmarshalAnyFromString Uses

func UnmarshalAnyFromString(str string) (Any, error)

func Wrap Uses

func Wrap(val interface{}) Any

func WrapFloat64 Uses

func WrapFloat64(val float64) Any

func WrapInt32 Uses

func WrapInt32(val int32) Any

func WrapInt64 Uses

func WrapInt64(val int64) Any

func WrapString Uses

func WrapString(val string) Any

func WrapUint32 Uses

func WrapUint32(val uint32) Any

func WrapUint64 Uses

func WrapUint64(val uint64) Any

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 EncoderFunc Uses

type EncoderFunc func(ptr unsafe.Pointer, stream *Stream)

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() 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) Reset Uses

func (b *Stream) Reset(out 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 11 packages (graph). Updated 2017-04-28. Refresh now. Tools for package owners.