package formatters
import (
"encoding/json"
)
type jsonFormatter struct {}
func NewJSONFormatter() *jsonFormatter {
return &jsonFormatter{}
}
func (jf *jsonFormatter) Serialise(v interface{}) string {
b, err := json.MarshalIndent(v, "", " ")
if err != nil {
return ""}
return string(b)
}
|
The pages are generated with Golds v0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |