I use the json.Marshal
interface to accept a map[string]interface{}
and convert it to a []byte
(is this a byte array?)
data, _ := json.Marshal(value)
log.Printf("%s
", data)
I get this output
{"email_address":"joe@me.com","street_address":"123 Anywhere Anytown","name":"joe","output":"Hello World","status":1}
The underlying bytes pertain to the struct of the below declaration
type Person struct {
Name string `json:"name"`
StreetAddress string `json:"street_address"`
Output string `json:"output"`
Status float64 `json:"status"`
EmailAddress string `json:"email_address",omitempty"`
}
I'd like to take data
and generate a variable of type Person struct
How do I do that?