Fluent API to make it easier to create Json objects.
go get github.com/ricardolonga/jsongo
To create this:
{
"name":"Ricardo Longa",
"idade":28,
"owner":true,
"skills":[
"Golang",
"Android"
]
}
Do this:
import (
j "github.com/ricardolonga/jsongo"
)
json := j.Object().Put("name", "Ricardo Longa").
Put("idade", 28).
Put("owner", true).
Put("skills", j.Array().Put("Golang").
Put("Android"))
log.Println(json.Indent())
log.Println(json.String())
json.Indent()
json.String()
json.Remove("skills")
json.Get("skills") // Return is interface{}.
results := Array().Put("Golang").Put("Android").Put("Java")
for i, result := range results.Array() {
}
array := j.Array().Put("Android").
Put("Golang").
Put("Java")
array.Size() // Result is 3.
Copyright (c) 2015 Ricardo Longa.
Jsongo is licensed under the Apache License Version 2.0. See the LICENSE file for more information.