Files
p/json.go
2024-11-26 13:26:26 -06:00

15 lines
228 B
Go

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)
}