10 lines
215 B
Go
Raw Normal View History

2017-07-07 00:07:34 +00:00
package utils
2018-07-02 00:39:25 +00:00
import jsoniter "github.com/json-iterator/go"
2017-07-07 00:07:34 +00:00
// ToJSON converts an object to a JSON string, ignoring errors.
func ToJSON(v interface{}) string {
2018-07-02 00:39:25 +00:00
str, _ := jsoniter.Marshal(v)
2017-07-07 00:07:34 +00:00
return string(str)
}