title: Go - constructing struct/json on the fly
body: <p>In Python it is possible to create a dictionary and serialize it as a JSON object like this:</p>
  
  <pre><code>example = { "key1" : 123, "key2" : "value2" }
  js = json.dumps(example)
  </code></pre>
  
  <p>Go is statically typed, so we have to declare the object schema first:</p>
  
  <pre><code>type Example struct {
      Key1 int
      Key2 string
  }
  
  example := &amp;Example { Key1 : 123, Key2 : "value2" }
  js, _ := json.Marshal(example)
  </code></pre>
  
  <p>Sometimes object (struct) with a specific schema (type declaration) is needed just in one place and nowhere else. I don't want to spawn numerous useless types, and I don't want to use reflection for this. </p>
  
  <p>Is there any syntactic sugar in Go that provides a more elegant way to do this? </p>