// SendResponseJSON sends data marshalled as a JSON body and sets the HTTP
// status code to sc.
SendResponseJSON sends data marshalled as a JSON body and sets the HTTP
status code to sc.
// SendResponseJSON sends data marshalled as a JSON body and sets the HTTP // status code to sc .
func SendResponseJSON(w http.ResponseWriter, statusCode int, data interface{}) {
	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(statusCode)
	if data == nil {
		return
	}
	err := json.NewEncoder(w).Encode(data)
	if err != nil {
		log.Printf("Error: encoding/sending JSON response: %s\n", err)
		return
	}
}
func SendResponseJSON ( w http . ResponseWriter , statusCode int , data interface { } ) { w . Header ( ) . Set ( " " , " " ) w . WriteHeader ( statusCode ) if data == nil { return } err := json . NewEncoder ( w ) . Encode ( data ) if err != nil { log . Printf ( " \n " , err ) return } }
SendResponseJSON sends data marshalled as a JSON body and sets the HTTP
status code to sc.
SendResponseJSON sends data marshalled as a JSON body and sets the HTTP status code to sc .
// We may have nothing to return other than a status code.