ourjson

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONOBJECTTYPE = "JsonObject"
	JSONARRAYTYPE  = "JsonArray"
	STRINGTYPE     = "string"
	BOOLEANTYPE    = "bool"
)

Variables

View Source
var (
	IndexOutOfRangeError = errors.New("index out of range")
	ValueNotNumberError  = errors.New("value is not number")
)

Functions

This section is empty.

Types

type Boolean

type Boolean struct {
	Valid bool
	Value bool
}

---------- Boolean ----------

func (*Boolean) UnmarshalJSON

func (b *Boolean) UnmarshalJSON(data []byte) error

type Float

type Float struct {
	Valid bool
	Value float64
}

---------- Float ----------

func (*Float) UnmarshalJSON

func (b *Float) UnmarshalJSON(data []byte) error

type Integer

type Integer struct {
	Valid bool
	Value int
}

---------- Integer ----------

func (*Integer) UnmarshalJSON

func (b *Integer) UnmarshalJSON(data []byte) error

type JsonArray

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

func ParseArray

func ParseArray(jsonStr string) (*JsonArray, error)

func (*JsonArray) Get

func (j *JsonArray) Get(index int) (*Value, error)

func (*JsonArray) GetBoolean

func (j *JsonArray) GetBoolean(index int) (bool, error)

func (*JsonArray) GetFloat64

func (j *JsonArray) GetFloat64(index int) (float64, error)

func (*JsonArray) GetInt

func (j *JsonArray) GetInt(index int) (int, error)

func (*JsonArray) GetInt64

func (j *JsonArray) GetInt64(index int) (int64, error)

func (*JsonArray) GetJsonArray

func (j *JsonArray) GetJsonArray(index int) *JsonArray

func (*JsonArray) GetJsonObject

func (j *JsonArray) GetJsonObject(index int) *JsonObject

func (*JsonArray) GetNullBoolean

func (j *JsonArray) GetNullBoolean(index int) (*Boolean, error)

func (*JsonArray) GetNullFloat

func (j *JsonArray) GetNullFloat(index int) (*Float, error)

func (*JsonArray) GetNullInt

func (j *JsonArray) GetNullInt(index int) (*Integer, error)

func (*JsonArray) GetNullLong

func (j *JsonArray) GetNullLong(index int) (*Long, error)

func (*JsonArray) GetString

func (j *JsonArray) GetString(index int) (string, error)

func (*JsonArray) String

func (j *JsonArray) String() string

func (*JsonArray) Value

func (j *JsonArray) Value() []*Value

type JsonObject

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

func NewJsonObject

func NewJsonObject() *JsonObject

func ParseObject

func ParseObject(jsonStr string) (*JsonObject, error)

func (*JsonObject) Get

func (j *JsonObject) Get(key string) (*Value, error)

func (*JsonObject) GetBoolean

func (j *JsonObject) GetBoolean(key string) (bool, error)

func (*JsonObject) GetFloat64

func (j *JsonObject) GetFloat64(key string) (float64, error)

func (*JsonObject) GetInt

func (j *JsonObject) GetInt(key string) (int, error)

func (*JsonObject) GetInt64

func (j *JsonObject) GetInt64(key string) (int64, error)

func (*JsonObject) GetJsonArray

func (j *JsonObject) GetJsonArray(key string) *JsonArray

func (*JsonObject) GetJsonObject

func (j *JsonObject) GetJsonObject(key string) *JsonObject

func (*JsonObject) GetNullBoolean

func (j *JsonObject) GetNullBoolean(key string) (*Boolean, error)

func (*JsonObject) GetNullFloat

func (j *JsonObject) GetNullFloat(key string) (*Float, error)

func (*JsonObject) GetNullInt

func (j *JsonObject) GetNullInt(key string) (*Integer, error)

func (*JsonObject) GetNullLong

func (j *JsonObject) GetNullLong(key string) (*Long, error)

func (*JsonObject) GetString

func (j *JsonObject) GetString(key string) (string, error)

func (*JsonObject) HasKey

func (j *JsonObject) HasKey(key string) bool

func (*JsonObject) Put

func (j *JsonObject) Put(key string, val interface{})

func (*JsonObject) Sort

func (j *JsonObject) Sort() *JsonObject

func (*JsonObject) String

func (j *JsonObject) String() string

func (*JsonObject) Value

func (j *JsonObject) Value() map[string]*Value

type KeyNotFoundError

type KeyNotFoundError struct {
	Key string
}

func (KeyNotFoundError) Error

func (e KeyNotFoundError) Error() string

type Long

type Long struct {
	Valid bool
	Value int64
}

---------- Long ----------

func (*Long) UnmarshalJSON

func (b *Long) UnmarshalJSON(data []byte) error

type Value

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

func (*Value) Boolean

func (v *Value) Boolean() (bool, error)

func (*Value) Float64

func (v *Value) Float64() (float64, error)

func (*Value) Int

func (v *Value) Int() (int, error)

func (*Value) Int64

func (v *Value) Int64() (int64, error)

func (*Value) JsonArray

func (v *Value) JsonArray() *JsonArray

func (*Value) JsonObject

func (v *Value) JsonObject() *JsonObject

func (*Value) MarshalJSON

func (v *Value) MarshalJSON() ([]byte, error)

func (*Value) NullBoolean

func (v *Value) NullBoolean() (*Boolean, error)

func (*Value) NullFloat

func (v *Value) NullFloat() (*Float, error)

func (*Value) NullInt

func (v *Value) NullInt() (*Integer, error)

func (*Value) NullLong

func (v *Value) NullLong() (*Long, error)

func (*Value) String

func (v *Value) String() (string, error)

type ValueTransformTypeError

type ValueTransformTypeError struct {
	Type string
}

func (ValueTransformTypeError) Error

func (e ValueTransformTypeError) Error() string

Jump to

Keyboard shortcuts

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