Skip to content

Instantly share code, notes, and snippets.

@derlin
Created August 16, 2016 09:14
Show Gist options
  • Save derlin/76b4209a864f5ce6f670be5b3f230aec to your computer and use it in GitHub Desktop.
Save derlin/76b4209a864f5ce6f670be5b3f230aec to your computer and use it in GitHub Desktop.
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))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment