Convenient JSON (cjson) is a highly inspired by eo-json, object-oriented JSON library for Go (golang).
$ go get -u github.com/kerelape/cjson
package main
import (
"encoding/json"
cjson "github.com/kerelape/cjson/pkg"
)
func main() {
object := cjson.NewObject().With("key", cjson.NewString("value"))
bytes, err := json.Marshal(object)
if err != nil {
panic(err)
}
println(string(bytes))
}
package main
import (
"encoding/json"
cjson "github.com/kerelape/cjson/pkg"
)
func main() {
root, err := cjson.NewDocument([]byte(`{"a":"b"}`)).Parse()
if err != nil {
panic(err)
}
println(root.Object().Value().Found("a").Value().String().Value().Content())
}
Fork this repository, make changes, send us a pull request. We will review your changes and apply them to the main
branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run the tests:
$ go test -v ./...
You will need Go 1.20+.