a Go package to interact with arbitrary handling indexed/array-type data (bitly lacks).
![Build Status]~~~~(https://secure.travis-ci.org/bitly/go-simplejson.png)~~~~
- do on Terminal
% go get github.com/gdaisukesuzuki/go-simplejson
- And in the source code, set as follows
import (
"github.com/gdaisukesuzuki/go-simplejson"
...
)
Visit the docs on gopkgdoc
Change Set/Add/Del..method returning value of error
Set()
SetEmpty()
SetPath()
... deprecated and will be deleted
SetEmptyPath()
... deprecated and will be deleted
Del()
DelIndex()
ZeroIndex()
AddIndex()
AddEmptyIndex()
SetIndex()
SetEmptyIndex()
trying adding 1 "method" (currently buggy)
GetMatchesIndex()
... return indexes and Json's from array whose keys(s) match value(s)
Fix the bugs.
newly added 4 "methods"
SetEmpty()
... modified from Set()
SetEmptyPath()
... modified from SetPath()
SetEmptyIndex()
... modified from SetIndex()
AddEmptyIndex()
... modified from AddIndex()
which replace/add JSON's emplty element {}
instead of some value
SampleCode (test01.go
) Handling Array of JSON/Struct Type.
This repository is folked from bitly, and changed by gdaisukesuzuki
so that "ARRAY / SLICE" in JSON eaily handled using go-simplejson
BY newley added 5 "METHODS"
SizeIndex()
... returns a size of Array/Slice
DelIndex()
... deletes one element of Array/Slice
ZeroIndex()
... creats or resets Array/Slice consisting zero element.
AddIndex()
... adds one element of Array/Slice ("Size" increased)
SetIndex()
... replaces one element of Array/Slice ("Size" not changed)
### Issues (as of 3/21/2018 18:00JST)
SetIndex can only set "Atom" type (ie int, string) but not set "Struct / Json" type.
eg. js.Get("Top").Get("hoge").SetIndex("poi",1,'{"a":1,"b":"B"}')