json.Unmarshal 遇到字段类型不一致时的行为。
作者: ansionfor创建于 2024年5月30日更新于 2025年1月8日
func TestJson(t *testing.T) {
type info struct {
Id int64 json:"id"
}
type test struct {
Result []info json:"result"
}
r := {"result":[{"id":"1"},{"id":"2"}]}
内容来源: json-iterator/go