Created
August 16, 2016 09:14
-
-
Save derlin/76b4209a864f5ce6f670be5b3f230aec to your computer and use it in GitHub Desktop.
Simple code to ease development while dealing with json.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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