This commit is contained in:
aozhiwei 2020-11-03 17:22:58 +08:00
parent 80edf5bfe5
commit 1e70d9f893

View File

@ -1,10 +1,13 @@
package q5
import "io"
import "strings"
import "crypto/md5"
import "encoding/hex"
import "hash/crc32"
import (
"io"
"strings"
"crypto/md5"
"encoding/hex"
"encoding/json"
"hash/crc32"
)
const (
JSON_NONE = 0
@ -45,3 +48,11 @@ func JsonStrType(data string) int32 {
}
}
}
func EncodeJson(p interface{}) string {
if jsonBytes, err := json.Marshal(p); err == nil {
return string(jsonBytes)
} else {
return ""
}
}