Files
t/json.go
Ian Gulliver 8a442173ee Initial commit
2024-12-06 22:51:31 -08: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)
}