diff --git a/strutils.go b/strutils.go index 63d7427..07ed35a 100644 --- a/strutils.go +++ b/strutils.go @@ -69,6 +69,11 @@ func EncodeJson(p interface{}) string { } } +func DecodeJson(data string, p interface{}) error { + err := json.Unmarshal([]byte(data), &p) + return err +} + func StrSplit(s string, sep string) []string { return strings.Split(s, sep) }