Documentation
¶
Index ¶
- func EscapePath(path string) string
- func IsNil(json *Json) bool
- type Json
- func Assign(source *Json, json ...*Json) *Json
- func Filter(collection []*Json, predicate func(v *Json) bool) []*Json
- func FromBytes(bytes []byte) *Json
- func FromMap(m map[string]interface{}) *Json
- func FromString(str string) *Json
- func Map(collection []*Json, iteratee func(v *Json) *Json) []*Json
- func Merge(jsons ...*Json) *Json
- func New() *Json
- func Nil() *Json
- func (j *Json) AsArray() []interface{}
- func (j *Json) AsBool() bool
- func (j *Json) AsFloat() float64
- func (j *Json) AsInt() int64
- func (j *Json) AsObject() map[string]interface{}
- func (j *Json) AsString() string
- func (j *Json) AsUint() uint64
- func (j *Json) Bytes() []byte
- func (j *Json) Clone() *Json
- func (j *Json) Data() interface{}
- func (j *Json) ForEach(iteratee func(k string, v *Json) bool)
- func (j *Json) Get(path string) *Json
- func (j *Json) Has(path string) bool
- func (j *Json) IsArray() bool
- func (j *Json) IsNil() bool
- func (j *Json) IsObject() bool
- func (j *Json) IsValue() bool
- func (j *Json) Keys() []string
- func (j *Json) MarshalJSON() ([]byte, error)
- func (j *Json) Rewrite(oldPath string, newPath string) bool
- func (j *Json) Set(path string, value interface{}) bool
- func (j *Json) Stringify() string
- func (j *Json) UnmarshalJSON(data []byte) error
- func (j *Json) Unset(path string) bool
- func (j *Json) Values() []*Json
- func (j *Json) Wrap(path string) *Json
- type Jsonizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapePath ¶ added in v1.0.5
EscapePath to escape a path Example
- By default jsonmap.Set("message.raw", "hello world !") => { "message": { "raw": "hello world !" }}
- With escape jsonmap.Set(jsonmap.EscapePath("message.raw"), "hello world !") => { "message.raw": "hello world !" }}
Types ¶
type Json ¶
type Json struct {
// contains filtered or unexported fields
}
Json is our wrapper to an unmarshalled json
func Assign ¶
Assign Assigns own enumerable string keyed properties of source objects to the destination object.
func Filter ¶
Filter iterates over elements of collection, returning an array of all elements predicate returns truthy for.
func (*Json) AsArray ¶
func (j *Json) AsArray() []interface{}
AsArray casts underlying to array ([]interface{}) Returns nil if not an array
func (*Json) AsObject ¶
AsObject casts underlying to object (map[string]interface{}) Returns nil if not an object
func (*Json) Clone ¶ added in v1.0.7
Clone to clone a json Not the best performance cause we marshal / unmarshal
func (*Json) ForEach ¶
ForEach : Iterates over elements of collection and invokes iteratee for each element. Iteratee functions may exit iteration early by explicitly returning false.
func (*Json) MarshalJSON ¶
MarshalJSON implements marshaler interface from encoding/json encode.go
func (*Json) Set ¶
Set sets the value at path of object. If a portion of path doesn't exist, it's created. Arrays are created for missing index properties while objects are created for all other missing properties
func (*Json) UnmarshalJSON ¶
UnmarshalJSON implements unmarshaler interface from encoding/json decode.go

