Files
x/json.go

15 lines
228 B
Go
Raw Normal View History

2024-11-26 15:04:05 -06:00
package main
import (
"encoding/json"
"net/http"
)
func sendJSON(w http.ResponseWriter, v any) {
w.Header().Set("Content-Type", "application/json")
enc := json.NewEncoder(w)
enc.SetEscapeHTML(false)
_ = enc.Encode(v)
}