Skip to content

JSON response helper for GoLang (useful for REST API services)

License

Notifications You must be signed in to change notification settings

FlxOne/golang-jresp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

golang-jresp

JSON response helper for GoLang (useful for REST API services)

Usage

jr := jresp.NewJsonResp()
jr.Set("name", "John Doe")
jr.OK()
jr.ToString(false) // Will print: {"parsetime":"1.988µs","ping":"pong","status":"OK"}

or in case of an error

jr := jresp.NewJsonResp()
jr.Error("Oops, something went wrong")
jr.ToString(false) // Will print:  {"parsetime":"1.988µs","error":"Oops, something went wrong","status":"ERROR"}

you can also pretty print

jr.ToString(true) // Will print the same JSON structure as usual, but then nicely formatted

About

JSON response helper for GoLang (useful for REST API services)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%