Golang Unmarshal Small problem

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
Normal condition: Func main ()  {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 "} ' var m  map[string]interface{}json. Unmarshal ([]byte (str),  &m) fmt. Println (m)}============================================================== console print:     map[ session_secret:6ce3910403a953006916f1fafef433c5 session_key:9mnrdl3cfpvaemqn4g2a4f1b+ Olbn4id079ghsdiumsosy9ayzgvtds2xo5fshmys+axztyqvtqsjksztiljd1uasaonxi9esg==scope :basic expires_in : 2.592e+06 refresh_token:22.84564433384c3dffdf8c2b123b6da8de.315360000.1756090115.2605827041-6701125  access_token:21.060aaae1049e2604d0fa71d992aea516.2592000.1443322115.2605827041-6701125] 

JSON string has newline func main () {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== "," Scope ":" Basic "} ' var m map[ String]interface{}json. Unmarshal ([]byte (str), &m) fmt. Println (m)}===================================================== console printed: map[]

Doubts: JSON string from the third-party platform feedback, I manually will have wrapped JSON string format can be resolved, the undo changes cannot be resolved, but in a manually modified string manually made line break can still be resolved

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.