This project says in its description: "Go library for decoding generic map values into native Go structures and vice versa."
However, I can't seem to figure out how to do the vice versa part.
Given the following:
type Person struct {
Name string
Age int
}
p := Person{
Name: "Foo",
Age: 30,
}
What function should I call to get this as a result:
m := mapstructure.Encode(p)
fmt.Printf("%#v", m)
// map[string]interface {}{"Age":30, "Name":"Foo"}