Chi router urlformat - too many arguments to render.JSON

Dear all,

I am a Python developer and I am just playing with golang. I tried a simple REST server but I am having some problem in compile time, but I don’t know why. The code snippet is show below.

AFAIK It follows the indications posted on

The render.JSON signature is JSON(w http.ResponseWriter, r *http.Request, v interface{})

It must be and absurd error but I am new into golang. Any one can spot and explain where the error is ?

Thanks for your time!

package main

import (


type articles struct {
	Name string `json:"name" xml:"name"`

func routes() http.Handler {
	r := chi.NewRouter()

	r.Get("/articles/{id}", listArticles)

	return r

func listArticles(w http.ResponseWriter, r *http.Request) {
	urlFormat, _ := r.Context().Value(middleware.URLFormatCtxKey).(string)

	switch urlFormat {
	case "json":
		render.JSON(w, r, articles{"json"})
	case "xml":
		render.XML(w, r, articles{"xml"})
		render.JSON(w, r, articles{"default"})


func main() {
	r := chi.NewRouter()

	r.Mount("/", routes())

	http.ListenAndServe(":3333", r)

Which? Show us, please.

Ok, the error was related with the mistake of mixing of gin framework and chi. Now it’s solved.

Thanks a lot!