I am trying to build a map[string]map[string]string which will look something like this:
{ "notes":
{
"Title":note.Title,
"Body":note.Body,
},
{
"Title":note.Title,
"Body":note.Body,
},
{
"Title":note.Title,
"Body":note.Body,
},
}
from a struct (notes) of structs (note)
I have thought of doing it like this:
for _, note := range notes {
thisNote := map[string]string{
"Title":note.Title,
"Body":note.Body,
}
content["notes"] = append(content["notes"], thisNote)
}
But obviously that is not going to work because I am trying to append a map to a map rather than a slice.
Is there a really easy solution to this that I am missing?