code: func JSONResponse(w http.ResponseWriter, code int, data interface{}) {
  	w.Header()["Content-Type"] = []string{"application/json"}
  	w.WriteHeader(code)
  	switch code {
  	case 204, 304:
  		/* no body */
  	default:
  		if data == nil {
  			data = ResourceError{code, "Server Error"}
  		}
  		b, e := json.MarshalIndent(data, "", "  ")
  		if e != nil {
  			code = http.StatusInternalServerError
  			b, _ = json.MarshalIndent(ResourceError{500, "Server Error"}, "", "  ")
  		}
  		fmt.Fprintf(w, "%s\n", string(b))
  	}
  }
docs: // JSONResponse provides response encoded as JSON.