title: Create Json in VB.net from string and use it in WebRequest
body: <p>I'm trying to call <a href="https://openrouteservice.org/" rel="nofollow noreferrer">openrouteservice api</a> in vb.net and therefore tried to follow the <a href="https://openrouteservice.org/dev/#/api-docs/v2/directions/%7Bprofile%7D/gpx/post" rel="nofollow noreferrer">documentation/examples</a>. The example shows below code as working example:</p>
  <pre><code>Sub Main(args As String())
      Dim request = TryCast(System.Net.WebRequest.Create(&quot;https://api.openrouteservice.org/v2/directions/driving-car/gpx&quot;), System.Net.HttpWebRequest)
  
      request.Method = &quot;POST&quot;
  
      request.Accept = &quot;application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8&quot;
      request.Headers.Add(&quot;Authorization&quot;, &quot;xxxxMYKEYxxxx&quot;)
      request.Headers.Add(&quot;Content-Type&quot;, &quot;application/json; charset=utf-8&quot;)
  
      Using writer = New System.IO.StreamWriter(request.GetRequestStream())
          Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes({&quot;coordinates:[[8.681495,49.41461],[8.686507,49.41943],[8.687872,49.420318]]&quot;})
          request.ContentLength = byteArray.Length
          writer.Write(byteArray)
          writer.Close()
      End Using
      Dim responseContent As String
      Using response = TryCast(request.GetResponse(), System.Net.HttpWebResponse)
          Using reader = New System.IO.StreamReader(response.GetResponseStream())
              responseContent = reader.ReadToEnd()
              Console.WriteLine(responseContent.ToString())
          End Using
      End Using
  End Sub
  </code></pre>
  <p>The example shows that the content of the request body should be the following:</p>
  <pre><code>{&quot;coordinates&quot;:[[8.681495,49.41461],[8.686507,49.41943],[8.687872,49.420318]]}
  </code></pre>
  <p>But when running the example i get the following error:</p>
  <pre><code>'The remote server returned an error: (500) Internal Server Error.'
  </code></pre>
  <p>So i figured that the request fails because of the invalid Json.
  My question is how to create a JSON resulting in the same as in the example-JSON provided above?</p>