背景:goland后台使用json.Marshal转换时,会将<,>,&转化为unicode编码,导致入库时&变成\u0026。
原因: json.marshal默认escapeHtml为true,会将<、>、&等字符转义。
解决方案1:
import (
"bytes"
"encoding/json"
"fmt"
)
type MarshalTest struct {
Url string `json:"url"`
}
//序列化
func marshal_inner(data interface{
}) ([