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, iterator 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 *StSetOptions) ([]byte, error)
- func SetModifiersState(b bool)
- func SetOptions(json, path string, value interface{}, opts *StSetOptions) (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 *StSetOptions) ([]byte, error)
- func SetRawOptions(json, path, value string, opts *StSetOptions) (string, error)
- func Stringify(value interface{}) (json string)
- func Ugly(json []byte) []byte
- func Unmarshal(json, v interface{}) error
- func UnmarshalValidationEnabled(enabled bool)
- func Valid(json string) (ok bool)
- func ValidBytes(json []byte) bool
- type Map
- type Res
- func (r Res) Array() []Res
- func (r Res) Bool() bool
- func (r Res) Exists() bool
- func (r Res) Float() float64
- func (r Res) ForEach(iterator 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() map[string]Res
- func (r Res) String() string
- func (r Res) Time(format ...string) time.Time
- func (r Res) Uint() uint
- func (r Res) Unmarshal(v interface{}) error
- func (r Res) Value() interface{}
- type StFormatOptions
- type StSetOptions
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefOptions = &StFormatOptions{Width: 80, Prefix: "", Indent: " ", SortKeys: false} Maches = []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 SetBytesOptions(json []byte, path string, value interface{}, opts *StSetOptions) ([]byte, error)
func SetModifiersState ¶
func SetModifiersState(b bool)
func SetOptions ¶
func SetOptions(json, path string, value interface{}, opts *StSetOptions) (string, error)
func SetRawBytesOptions ¶
func SetRawOptions ¶
func SetRawOptions(json, path, value string, opts *StSetOptions) (string, error)
func UnmarshalValidationEnabled ¶
func UnmarshalValidationEnabled(enabled bool)
func ValidBytes ¶
Types ¶
type StFormatOptions ¶
type StSetOptions ¶
Click to show internal directories.
Click to hide internal directories.