bbgo_origin/pkg/util/json.go

16 lines
232 B
Go
Raw Normal View History

2022-05-17 10:23:09 +00:00
package util
import (
"encoding/json"
"io/ioutil"
)
func WriteJsonFile(p string, obj interface{}) error {
out, err := json.MarshalIndent(obj, "", " ")
if err != nil {
return err
}
return ioutil.WriteFile(p, out, 0644)
}