Use jsoniter to improve performance

This commit is contained in:
2018-07-02 09:39:25 +09:00
parent bb1ce79d95
commit 082e16fb42
4 changed files with 9 additions and 9 deletions

View File

@ -1,9 +1,9 @@
package utils
import "encoding/json"
import jsoniter "github.com/json-iterator/go"
// ToJSON converts an object to a JSON string, ignoring errors.
func ToJSON(v interface{}) string {
str, _ := json.Marshal(v)
str, _ := jsoniter.Marshal(v)
return string(str)
}