Posted in

为什么json.Marshal(json.Unmarshal(x)) ≠ x?map[string]interface{}转义残留导致的恒等性失效(含单元测试用例)

第一章:为什么json.Mars … 为什么json.Marshal(json.Unmarshal(x)) ≠ x?map[string]interface{}转义残留导致的恒等性失效(含单元测试用例)Read more

Posted in

Go中json.Marshal(map[string]interface{})输出顺序随机?别再被测试用例偶现失败折磨了(Go 1.21 deterministic fix)

第一章:Go中json.Mars … Go中json.Marshal(map[string]interface{})输出顺序随机?别再被测试用例偶现失败折磨了(Go 1.21 deterministic fix)Read more

Posted in

【Go 1.22新特性预警】:json.Marshal现在对map[string]any的处理逻辑变更,导致旧代码map转JSON突现字符串化(含迁移checklist)

第一章:Go 1.22中json … 【Go 1.22新特性预警】:json.Marshal现在对map[string]any的处理逻辑变更,导致旧代码map转JSON突现字符串化(含迁移checklist)Read more

Posted in

Go中map不转JSON转string?这不是bug,是json.Marshal()对nil map、unexported field、time.Time的默认妥协策略

第一章:Go中map转JSON时 … Go中map不转JSON转string?这不是bug,是json.Marshal()对nil map、unexported field、time.Time的默认妥协策略Read more