Recently I’ve been implementing a small side project in Go with Gin. I know how easy it is to setup tests with Go, but I was very surprised not many people had covered examples of how to test the JSON responses for your APIs. With Gin specifically. I discovered, it’s quite simple. First we want an endpoint to test so here we go. The following would return a simple {"hello":"world"} JSON response.
![Golang Testing — JSON Responses with Gin](https://cdn-ak-scissors.b.st-hatena.com/image/square/4c719e3e41c5a94b6dce81978f0f117c1485b701/height=288;version=1;width=512/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A640%2F1%2AuBNxDThO_Zp15_dp-qwjtg.jpeg)