json.go
410 Bytes
package zjson
import "encoding/json"
func Byte(obj any) (buf []byte) {
jsons, err := json.Marshal(obj)
if err == nil {
buf = jsons
} else {
}
return
}
func Str(obj any) (text string) {
jsons, err := json.Marshal(obj)
if err == nil {
text = string(jsons)
} else {
}
return
}
func Obj(text string, obj any) (err error) {
err = json.Unmarshal([]byte(text), &obj)
if err != nil {
}
return
}