RWKV-Runner/backend-golang/config.go
2023-05-06 20:17:39 +08:00

19 lines
322 B
Go

package backend_golang
import (
"encoding/json"
"os"
)
func (a *App) SaveJson(fileName string, jsonData interface{}) string {
text, err := json.MarshalIndent(jsonData, "", " ")
if err != nil {
return err.Error()
}
if err := os.WriteFile(fileName, text, 0644); err != nil {
return err.Error()
}
return ""
}