package api import ( "encoding/json" "io" ) func encodeJSON(w io.Writer, v interface{}) error { enc := json.NewEncoder(w) return enc.Encode(v) }