Example creating structs on the fly
// http://play.golang.org/p/TVFHKUHO2p
package main
import "fmt"
import "encoding/json"
func main() {
type error struct {
Message string `json:"message"`
}
mapD := map[string]interface{}{"error": error{Message: "hi"}}
mapB, _ := json.Marshal(mapD)
fmt.Println(string(mapB))
}