derlin
8/16/2016 - 9:14 AM

Simple code to ease development while dealing with json.

Simple code to ease development while dealing with json.

imoprt "encoding/json"

func printJson(in interface{}) {
        b, _ := json.Marshal(in)
        fmt.Println(string(b))
}

func printJsonErr(in interface{}, err error) {
        if (err != nil) {
                fmt.Println(err)
        } else {
                b, _ := json.Marshal(in)
                fmt.Println(string(b))
        }
}