title: How do I embed an interface inside of a struct without the interface name becoming a key inside of the JSON?
body: <p>I have an interface, EventAggregation, that is implemented by many different types. I need to enrich all of these types with the same two fields so I'm doing something like this:</p>
  
  <pre><code>type messagePayload struct {
      domain.EventAggregation
      SourceSystem     string `json:"sourceSystem"`
      MessageTimestamp int    `json:"messageTimestamp"`
  }
  </code></pre>
  
  <p>I then translate that to a string with this method:</p>
  
  <pre><code>func (payload messagePayload) payloadToString() string {
      jsonForm, _ := json.Marshal(payload)
      return string(jsonForm)
  }
  </code></pre>
  
  <p>But it creates a string with "EventAggregation" as a key and the fields are embedded as an object within it like this:</p>
  
  <pre><code>{"EventAggregation":{"startTime":1575941942501,"endTime":1581461995869,"computeTimestamp":1582573485983,"eventType":"foo","count":146692},"sourceSystem":"bar","messageTimestamp":1582573497406}
  </code></pre>
  
  <p>How do I create the string in a way such that the fields within the EventAggregation are at the same level as the fields "SourceSystem" and "MessageTimestamp"? Like this:</p>
  
  <pre><code>{"startTime":1575941942501,"endTime":1581461995869,"computeTimestamp":1582573485983,"eventType":"foo","count":146692,"sourceSystem":"bar","messageTimestamp":1582573497406}
  </code></pre>
  
  <p>The same code seems to work if the embedded object is a struct instead of an interface but that isn't super practical given how many different structs implement the "EventAggregation" interface.</p>