gojson

package module
v0.0.0-...-c7db8af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2019 License: MIT Imports: 7 Imported by: 0

README

gojson

Documentation

Index

Constants

View Source
const (
	MaxInt = int64(^uint(0) >> 1)
)

Variables

View Source
var (
	JsonIter = jsoniter.Config{
		EscapeHTML:             true,
		SortMapKeys:            true,
		ValidateJsonRawMessage: true,
		UseNumber:              true,
	}.Froze()

	ErrNotFound = errors.New("not found")
	ErrDecode   = errors.New("wrong decode")
	ErrOverflow = errors.New("overflow")
)

Functions

This section is empty.

Types

type Json

type Json struct {
	// contains filtered or unexported fields
}

func FromBytes

func FromBytes(bytes []byte) (j *Json)

func FromString

func FromString(str string) (j *Json)

func New

func New(r io.Reader) (j *Json)

func (*Json) Array

func (j *Json) Array() ([]*Json, error)

func (*Json) ArrayLength

func (j *Json) ArrayLength() (int, error)

func (*Json) Bool

func (j *Json) Bool() (ret bool, err error)

func (*Json) Data

func (j *Json) Data() (ret string, err error)

Data return the raw data as string

func (*Json) Err

func (j *Json) Err() error

func (*Json) Float

func (j *Json) Float() (ret float64, err error)

func (*Json) Get

func (j *Json) Get(key string) *Json

Get return Json of the key,return ErrWrongType if caller not a JsonObject

func (*Json) Index

func (j *Json) Index(idx int) *Json

Get return Json of the key,return ErrWrongType if caller not a JsonArray

func (*Json) Int

func (j *Json) Int() (int, error)

Int convert the number to int,return ErrOverflow when overflow

func (*Json) Int32

func (j *Json) Int32() (int32, error)

func (*Json) Int64

func (j *Json) Int64() (ret int64, err error)

func (*Json) Interface

func (j *Json) Interface() (it interface{}, err error)

Interface unmarshal to an interface{} ,same as Read

func (*Json) Ints

func (j *Json) Ints() (it []int, err error)

func (*Json) IsNull

func (j *Json) IsNull() (ok bool, err error)

func (*Json) Keys

func (j *Json) Keys() ([]string, error)

func (*Json) Read

func (j *Json) Read(obj interface{}) error

func (*Json) String

func (j *Json) String() (ret string, err error)

String convert the value to string

func (*Json) Strings

func (j *Json) Strings() (it []string, err error)

func (*Json) Uint32

func (j *Json) Uint32() (uint32, error)

func (*Json) Uint64

func (j *Json) Uint64() (ret uint64, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL