Convert JSON string to map[string]interface{}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// json string
jsonStr := `{
"Name": "noknow",
"Age": 2,
"Admin": true,
"Hobbies": ["IT","Travel"],
"Address": {
"PostalCode": 1111,
"Country": "Japan"
},
"Null": null
}`
// Convert json string to map[string]interface{}
var mapData map[string]interface{}
if err := json.Unmarshal([]byte(jsonStr), &mapData); err != nil {
fmt.Println(err)
}
|
No notes link to this note