> For the complete documentation index, see [llms.txt](https://alexisvisco.gitbook.io/kcd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alexisvisco.gitbook.io/kcd/output/returning-json-response.md).

# Returning JSON response

```go
package main

import (
   "net/http"

   "github.com/go-chi/chi"

   "github.com/alexisvisco/kcd"
)

func main() {
   r := chi.NewRouter()
   r.Get("/", kcd.Handler(YourHttpHandler, http.StatusOK))
   _ = http.ListenAndServe(":3000", r)
}

type Output struct {
   Name string `json:"name"`

}


func YourHttpHandler() (Output, error) {
   return Output{
      Name: "Hello world",
   }, nil
}

// Test it : curl 'localhost:3000'
```

{% hint style="info" %}
More information on how to change the behavior of the output with the render hook.
{% endhint %}
