json反序列化坑之gzip
golangjson反序列化gzip
invalid character '\x1f' looking for beginning of valueContent-Encoding gzip
解决方法
ungzipbody, _ := gzip.NewReader(resp.Body)
// 使用gzip读取解压
defer resp.Body.Close()
content, _ := ioutil.ReadAll(ungzipbody)
responseData := &ResponseJson{}
json.Unmarshal(content, responseData)