title: Send a POST request of JSON content-type and display JSON response in VB.NET
body: <p>I am trying to send a POST request to shapeshift which has few parameters to be sent as JSON and then wish to display part of the response in VB.NET </p>
  
  <p>Documentation from shapeshift: <a href="https://info.shapeshift.io/api#api-9" rel="nofollow noreferrer">https://info.shapeshift.io/api#api-9</a></p>
  
  <p>Below is what I have tried until now:</p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  
      Dim request As HttpWebRequest
      Dim response As HttpWebResponse
      Dim reader As StreamReader
      Dim rawresponse As String
  
      Try
  
          request = DirectCast(WebRequest.Create("https://shapeshift.io/sendamount"), HttpWebRequest)
          request.ContentType = "application/json"
          request.Method = "POST"
  
          Dim postdata As String = "{""amount"":}" + TextBox1.Text + "{,""withdrawal"":}" + TextBox2.Text + "{,""pair"":""btc_eth""}" + "{,""returnAddress"":}" + TextBox3.Text
          request.ContentLength = postdata.Length
  
          Dim requestWriter As StreamWriter = New StreamWriter(request.GetRequestStream())
          requestWriter.Write(postdata)
          requestWriter.Close()
  
          response = DirectCast(request.GetResponse(), HttpWebResponse)
          reader = New StreamReader(response.GetResponseStream())
  
  
          rawresponse = reader.ReadToEnd()
  
     Catch ex As Exception
          Console.WriteLine(ex.ToString)
     End Try
  
     Dim json As String = rawresponse
     Dim jsonObject As Newtonsoft.Json.Linq.JObject = Newtonsoft.Json.Linq.JObject.Parse(json)
  
     Label1.Text = jsonObject("expiration").ToString
  
  End Sub
  </code></pre>
  
  <p>ERROR I get is: 400 Bad Request</p>
  
  <p>I think its because I have messed up something in code where JSON POST request is explained. I did a lot of research and tried few things but nothing worked :(</p>