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
|
|
|
|
|
|
|
func ConvertFromJSON(body io.ReadCloser, inter interface{}) {
|
|
|
|
json_err := json.NewDecoder(body).Decode(&inter)
|
|
|
|
_ = json_err //TODO work with errors
|
|
|
|
}
|