1234567891011121314151617181920 |
- package util
- import (
- "encoding/json"
- "log"
- )
- func MarshalToString(in interface{}) string {
- out, _ := json.Marshal(in)
- return string(out)
- }
- func MapToString(in map[string]interface{}) string {
- out, err := json.Marshal(in)
- if err != nil {
- log.Default().Printf("%+v\n", err)
- return ""
- }
- return string(out)
- }
|