title: How can I parse JSON in GoLang if nested content uses dynamic keys?
body: <p>I received JSON below from a client API but i am struggling to get nested JSON content. How can I parse it if the inner keys are dynamic?</p>
  
  <pre><code>const jsonStream = `
  {
      "items": {
          "bvu62fu6dq": {
              "name": "john",
              "age": 23,
              "xyz": "weu33s"
          },
          "iaxdw23fq": {
              "name": "kelly",
              "age": 21,
              "xyz": "weu33s"
          }
      }
  }`
  </code></pre>
  
  <p>This is what i have tried below by looping the map to extract the value of name and age from above JSON string; but it returns map with nil value as a result.
  <a href="http://play.golang.org/p/Y5-2cwsRhE" rel="nofollow">goplaygound</a></p>
  
  <pre><code>type Person struct {
      Name string `json:"name"`
      Age  int    `json:"age"`
  }
  type Item struct {
      Contact struct {
          Info map[string]Person
      } `json:"items"`
  }
  
  func main() {
      dec := json.NewDecoder(strings.NewReader(jsonStream))
      for {
          var item Item
          if err := dec.Decode(&amp;item); err == io.EOF {
              break
          } else if err != nil {
              log.Fatal(err)
          }
          fmt.Printf("%s\n", item.Contact.Info["bvu62fu6dq"].Name)
      }
  }
  </code></pre>