title: Unable to send JSON as body for HTTP POST request in GO
body: <p>When i make the POST request using the below GO Function. I get a <code>invalid json</code> on the server side. </p>
  
  <p>If i send static json for example </p>
  
  <pre><code>var jsonprep = []byte(`{"username":"xyz@gmail.com","password":"xyz123"}`) 
  </code></pre>
  
  <p>it does work instead of </p>
  
  <pre><code>var jsonprep string = "`{username:"+username+",password:"+password+"}`"
  </code></pre>
  
  <p>.</p>
  
  <pre><code>func makeHttpPostReq(url string, username string, password string){
  
      client := http.Client{}
  
  
      var jsonprep string = "`{username:"+username+",password:"+password+"}`"
  
      var jsonStr = []byte(jsonprep)
  
      req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
      req.Header.Set("Content-Type", "application/json")
  
      resp, err := client.Do(req)
      if err != nil {
           fmt.Println("Unable to reach the server.")
      } else {
           body, _ := ioutil.ReadAll(resp.Body)
           fmt.Println("body=", string(body))
      }
  
  }
  </code></pre>