title: How to send JSON String with POST using ktor kotlin?
body: <p>How to add JSON String in the POST request using kotlin and ktor?</p>
  <p>Printing it out the Json string read from file or even constructed string with Kotlin in the client, the content looks like JSON.</p>
  <p>Still, the server cannot recognize the string as JSON, and when I print it in the server, each double quota is back slashed.</p>
  <p>The client obviously adds the back slashes, thus the request is not formatted as it should.</p>
  <p>Client Kotlin - Ktor code:</p>
  <pre><code>import com.google.gson.*
  import io.ktor.client.*
  import io.ktor.http.*
  
  ...
  val client = HttpClient(OkHttp) {
     
      install(JsonFeature) {
          serializer = GsonSerializer()
      }
  
  }
  val fileContent = MyClass::class.java.getResource(&quot;myfile&quot;).readText()
  println(&quot;fileContent string = $fileContent&quot;)
  
  
  val out = client.post&lt;String&gt; {
      url(url)
      contentType(ContentType.Application.Json)
      body =  fileContent
  }
  </code></pre>
  <p>the print out looks like this :</p>
  <pre><code>{ &quot;name&quot;: &quot;myname&quot;, &quot;value&quot;: &quot;myvalue&quot; }
  </code></pre>
  <p>but the server (I use hookbin by the way to really print out the data without Jackson conversions) prints out:</p>
  <pre><code>{ \&quot;name\&quot;: \&quot;myname\&quot;, \&quot;value\&quot;: \&quot;myvalue\&quot; }
  </code></pre>