If you’re struggling with understanding how GoLang reads JSON you will need learn these tips to navigate quickly to be productive. Here are a few tips to use when working with JSON within the programming language Golang.
Data := make(map[string]interface{})
var data = `
{
"array": [
1,
2,
3
],
"boolean": true,
"null": null,
"number": 123,
"object": {
"a": "b",
"c": "d",
"e": "f"
},
"string": "Hello World"
}`
if err := json.Unmarshal([]byte(data), &Data); err != nil { panic(err) }
You’ll be able to print this GoLang (Go) Struct using the following code below.
fmt.Printf("%s", jsonMap)
#golang #golang-tutorial #programming #json #go