️ 使用 json-iterator 替换 encoding/json 进行一些序列化/反序列化操作

This commit is contained in:
naiba
2022-03-18 23:13:22 +08:00
parent d928f65052
commit 3ca23d8d88
14 changed files with 46 additions and 37 deletions

View File

@@ -1,9 +1,9 @@
package model
import (
"encoding/json"
"testing"
"github.com/naiba/nezha/pkg/utils"
"github.com/stretchr/testify/assert"
)
@@ -21,7 +21,7 @@ func TestServerMarshal(t *testing.T) {
}
serverStr := string(server.Marshal())
var serverRestore Server
assert.Nil(t, json.Unmarshal([]byte(serverStr), &serverRestore))
assert.Nil(t, utils.Json.Unmarshal([]byte(serverStr), &serverRestore))
assert.Equal(t, server, serverRestore)
}
}