坑1

int类型使用json Marshal,然后使用Unmarshal后,会转换成float64 – 向上取
demo

	demo := make(map[string]interface{}, 5)demo["a"] = 1mv, err := json.Marshal(demo)if err != nil {fmt.Println("marshal failed, ", err.Error())return}result := make(map[string]interface{}, 5)err = json.Unmarshal(mv, &result)if err != nil {fmt.Println("unmarshal failed, ", err.Error())return}fmt.Println(result["a"].(int))

输出结果
输出结果
应该改为,最后一行改为float64

	demo := make(map[string]interface{}, 5)...fmt.Println(result["a"].(float64))
  1. 待发现