sharedutils/jsonUtils/jsonUtils.go

19 lines
360 B
Go
Raw Normal View History

2022-11-01 23:42:40 +00:00
package jsonutils
2022-11-02 09:53:30 +00:00
//TODO: Rename package
import (
"encoding/json"
"io"
)
2022-11-01 23:42:40 +00:00
func ConvertToJSON(g interface{}) []byte {
g_json, err := json.Marshal(g)
_ = err //TODO: Check Errors
return g_json
}
2022-11-02 09:53:30 +00:00
2022-11-02 10:30:27 +00:00
func ConvertResponseFromJSON(body io.ReadCloser, inter interface{}) {
2022-11-02 09:53:30 +00:00
json_err := json.NewDecoder(body).Decode(&inter)
_ = json_err //TODO work with errors
}