struct.go 191 B

123456789101112
  1. package common
  2. import "encoding/json"
  3. func InterfaceToJsonString(obj interface{}) string {
  4. jsonBytes, err := json.Marshal(obj)
  5. if err == nil {
  6. return string(jsonBytes)
  7. }
  8. return ""
  9. }