I tried to "Unmarshal" json in golang, but it doesn't seem to be working. I get 0 printed out instead of 1. What am I doing wrong?
package main
import (
"fmt"
"encoding/json"
)
type MyTypeA struct {
a int
}
func main() {
var smthng MyTypeA
jsonByteArray := []byte(`{"a": 1}`)
json.Unmarshal(jsonByteArray, &smthng)
fmt.Println(smthng.a)
}