Documentation ¶
Overview ¶
Package zjson json data read and write operations
Index ¶
- Variables
- func AddModifier(name string, fn func(json, arg string) string)
- func Delete(json, path string) (string, error)
- func DeleteBytes(json []byte, path string) ([]byte, error)
- func Discard(json string) (string, error)
- func ForEachLine(json string, fn func(line *Res) bool)
- func Format(json []byte) []byte
- func FormatOptions(json []byte, opts *StFormatOptions) []byte
- func Marshal(json interface{}) ([]byte, error)
- func ModifierExists(name string) bool
- func ModifiersState() bool
- func Set(json, path string, value interface{}) (string, error)
- func SetBytes(json []byte, path string, value interface{}) ([]byte, error)
- func SetBytesOptions(json []byte, path string, value interface{}, opts *Options) ([]byte, error)
- func SetModifiersState(b bool)
- func SetOptions(json, path string, value interface{}, opts *Options) (string, error)
- func SetRaw(json, path, value string) (string, error)
- func SetRawBytes(json []byte, path string, value []byte) ([]byte, error)
- func SetRawBytesOptions(json []byte, path string, value []byte, opts *Options) ([]byte, error)
- func SetRawOptions(json, path, value string, opts *Options) (string, error)
- func Stringify(value interface{}) (json string)
- func Ugly(json []byte) []byte
- func Unmarshal(json, v interface{}) error
- func Valid(json string) (ok bool)
- func ValidBytes(json []byte) bool
- type Map
- type Options
- type Res
- func (r *Res) Array() []*Res
- func (r *Res) Bool() bool
- func (r *Res) Bytes() []byte
- func (r *Res) Delete(path string) (err error)
- func (r *Res) Exists() bool
- func (r *Res) Filter(fn func(key, value *Res) bool) *Res
- func (r *Res) Float() float64
- func (r *Res) ForEach(fn func(key, value *Res) bool)
- func (r *Res) Get(path string) *Res
- func (r *Res) Int() int
- func (r *Res) IsArray() bool
- func (r *Res) IsObject() bool
- func (r *Res) Map() ztype.Map
- func (r *Res) MapKeys(exclude ...string) (keys []string)
- func (r *Res) MapRes() map[string]*Res
- func (r *Res) Maps() ztype.Maps
- func (r *Res) MatchKeys(keys []string) *Res
- func (r *Res) Raw() string
- func (r *Res) Set(path string, value interface{}) (err error)
- func (r *Res) Slice() ztype.SliceType
- func (r *Res) SliceInt() []int
- func (r *Res) SliceString() []string
- func (r *Res) String() string
- func (r *Res) Time(format ...string) (t time.Time)
- func (r *Res) Uint() uint
- func (r *Res) Unmarshal(v interface{}) error
- func (r *Res) Value() interface{}
- type StFormatOptions
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefOptions = &StFormatOptions{Width: 80, Prefix: "", Indent: " ", SortKeys: false} Matches = []Map{ {"start": "//", "end": "\n"}, {"start": "/*", "end": "*/"}, } )
View Source
var ( ErrNoChange = errors.New("no change") ErrPathEmpty = errors.New("path cannot be empty") ErrInvalidJSON = errors.New("invalid json") ErrNotAllowedWildcard = errors.New("wildcard characters not allowed in path") ErrNotAllowedArrayAccess = errors.New("array access character not allowed in path") ErrTypeError = errors.New("json must be an object or array") )
Functions ¶
func AddModifier ¶
func ForEachLine ¶
func FormatOptions ¶
func FormatOptions(json []byte, opts *StFormatOptions) []byte
func ModifierExists ¶
func ModifiersState ¶
func ModifiersState() bool
func SetBytesOptions ¶
func SetModifiersState ¶
func SetModifiersState(b bool)
func SetOptions ¶
func SetRawBytesOptions ¶
func ValidBytes ¶
Types ¶
type Res ¶
type Res struct {
// contains filtered or unexported fields
}
func GetMultiple ¶
func GetMultipleBytes ¶
func ParseBytes ¶
func (*Res) SliceString ¶ added in v1.7.0
type StFormatOptions ¶
Click to show internal directories.
Click to hide internal directories.