golang Unmarshal 小问题

golang Unmarshal 小问题,第1张

概述正常情况:func main() { str := `{"expires_in":2592000,"refresh_token":"22.84564433384c3dffdf8c2b123b6da8de.315360000.1756090115.2605827041-6701125","access_token":"21.060aaae1049e2604d0fa71d992aea516.25
正常情况:funcmain(){	str:=`{"expires_in":2592000,"refresh_token":"22.84564433384c3dffdf8c2b123b6da8de.315360000.1756090115.2605827041-6701125","access_token":"21.060aaae1049e2604d0fa71d992aea516.2592000.1443322115.2605827041-6701125","session_secret":"6ce3910403a953006916f1fafef433c5","session_key":"9mnRdL3CfpvaeMqn4g2A4f1b+olbN4ID079GhsDIumsoSy9AYZgVtDs2XO5FsHMys+AxZtyqVtQSjkSZtilJd1UAsAoNxI9esg==","scope":"basic"}`	varmmap[string]interface{}	Json.Unmarshal([]byte(str),&m)	fmt.Println(m)}==============================================================控制台打印:map[session_secret:6ce3910403a953006916f1fafef433c5session_key:9mnRdL3CfpvaeMqn4g2A4f1b+olbN4ID079GhsDIumsoSy9AYZgVtDs2XO5FsHMys+AxZtyqVtQSjkSZtilJd1UAsAoNxI9esg==scope:basicexpires_in:2.592e+06refresh_token:22.84564433384c3dffdf8c2b123b6da8de.315360000.1756090115.2605827041-6701125access_token:21.060aaae1049e2604d0fa71d992aea516.2592000.1443322115.2605827041-6701125]
Json串有换行funcmain(){	str:=`{"expires_in":2592000,"refresh_token":"22.18aba8ebd4838130f9506f35f93a3ca2.315360000.1756092980.2605827041-6701125","access_token":"21.274921d56f67b0a2e2bf988bd695fbe7.2592000.1443324980.2605827041-6701125","session_secret":"21376476ea4eac56c3382883796615a8","session_key":"9mnRdvXn5BQJ3wGCnC\/UBA7DUyVivKDymYcPkNnFkrqS0n7OjAhiTGeKjAlDLSLs7h\/\/CibfnC8VZFJd+u8SZ02fpvHxlBPa7w==",&m)	fmt.Println(m)}=====================================================控制台打印:map[]

疑惑:Json串来自第三方平台反馈 ,我手动将带有换行的Json串调好格式可以解析,在撤销修改不能解析,但是在手动改好的串中手动制造换行却仍然可以解析

总结

以上是内存溢出为你收集整理的golang Unmarshal 小问题全部内容,希望文章能够帮你解决golang Unmarshal 小问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1287012.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存