wakapi/utils/template.go

15 lines
190 B
Go

package utils
import (
"encoding/json"
"html/template"
)
func Json(data interface{}) template.JS {
d, err := json.Marshal(data)
if err != nil {
return ""
}
return template.JS(d)
}