You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/utils/dorm/json.go

19 lines
436 B

1 year ago
package dorm
1 year ago
import (
"github.com/dtapps/go-library/utils/gojson"
)
1 year ago
// JsonDecodeNoError json字符串转结构体不报错
func JsonDecodeNoError(b []byte) map[string]interface{} {
var data map[string]interface{}
1 year ago
_ = gojson.Unmarshal(b, &data)
1 year ago
return data
}
// JsonEncodeNoError 结构体转json字符串不报错
func JsonEncodeNoError(data interface{}) string {
1 year ago
jsons, _ := gojson.Marshal(data)
1 year ago
return string(jsons)
}