go-jsonpp/fprettyprint.go

27 lines
326 B
Go
Raw Permalink Normal View History

2023-09-27 04:45:47 +00:00
package jsonpp
import (
"bytes"
"io"
)
func FPrettyPrint(writer io.Writer, json []byte) error {
if nil == writer {
return errNilWriter
}
var buffer bytes.Buffer
err := jsonPrettyPrint(&buffer, json)
if nil != err {
return err
}
_, err = buffer.WriteTo(writer)
if nil != err {
return err
}
return nil
}