Popularity
4.2
Growing
Activity
0.0
Stable
95
1
11

Programming language: Go
License: Apache License 2.0
Tags: Utilities    

jsongo alternatives and similar packages

Based on the "Utilities" category.
Alternatively, view jsongo alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of jsongo or a related project?

Add another 'Utilities' Package

README

Jsongo

Fluent API to make it easier to create Json objects.

travis-ci codecov goreportcard

Install

go get github.com/ricardolonga/jsongo

Usage

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())
Convert object/array to indented String:
json.Indent()
Convert object/array to String:
json.String()
To remove a field of the object:
json.Remove("skills")
To get a field of the object:
json.Get("skills") // Return is interface{}.
To range over a array:
results := Array().Put("Golang").Put("Android").Put("Java")

for i, result := range results.Array() {
}
To get Array size:
array := j.Array().Put("Android").
                   Put("Golang").
                   Put("Java")

array.Size() // Result is 3.

Copyright

Copyright (c) 2015 Ricardo Longa.
Jsongo is licensed under the Apache License Version 2.0. See the LICENSE file for more information.


*Note that all licence references and agreements mentioned in the jsongo README section above are relevant to that project's source code only.