Why wouldn't the following Go
program work? The map is empty after the Unmarshal. Is there any changes that I could do to deserialize this correctly? Or should I end up using yaml.Node
?
package main
import (
"fmt"
"gopkg.in/yaml.v3"
)
func main() {
empYaml := `
employees:
- id: 11
name: Irshad
department: IT
designation: Product Manager
address:
city: Mumba
state: Maharashtra
country: India
`
var result map[string]interface{}
yaml.Unmarshal([]byte(empYaml), &result)
fmt.Println(result)
}
Play URL: https://play.golang.org/p/tG44j15mNjH