title: How to create JSON array of objects using Go map?
body: <p>I need to create a JSON array using map.   </p>
  
  <pre><code>package main
  import "fmt"
  func main(){
      id := [5]string{"1","2","3","4","5"}
      name := [5]string{"A","B","C","D","E"}
      parseData := make(map[string]string)
      for counter,_ := range id {
          parseData["id"] = id[counter]
          parseData["name"] = name[counter]
          fmt.Println(parseData)
      }
  
  }
  </code></pre>
  
  <p>My current output:</p>
  
  <pre><code>map[id:1 name:A]
  map[id:2 name:B]
  map[id:3 name:C]
  map[id:4 name:D]
  map[id:5 name:E]
  </code></pre>
  
  <p>I need a JSON output like below:</p>
  
  <pre><code>[{id:1, name:A},
  {id:2, name:B},
  {id:3, name:C},
  {id:4, name:D},
  {id:5, name:E}]
  </code></pre>
  
  <p>I know basics of using map its a dictionary used for key:value pairs.How can I achieve JSON output using map.</p>