title: How to unmarshall akka http request entity as string?
body: <p>I'm trying to unmarshall request payload as string, but for some reason it's failing. My code:</p>
  
  <pre><code>path("mypath") {
  
    post {
      decodeRequest {
        entity(as[String]) {jsonStr =&gt; //could not find implicit value for...FromRequestUnmarshaller[String]
          complete {
            val json: JsObject = Json.parse(jsonStr).as[JsObject]
            val jsObjectFuture: Future[JsObject] = MyDatabase.addListItem(json)
            jsObjectFuture.map(_.as[String])
          }
        }          
      }
    }
  }
  </code></pre>
  
  <p>In this <a href="https://stackoverflow.com/questions/27073173/in-spray-how-to-unmarshall-plain-text">SO thread</a> for example it seems to be that this implicit should be available by default. But maybe this is different in akka-http?</p>
  
  <p>I tried importing <code>akka.http.scaladsl.unmarshalling.PredefinedFromEntityUnmarshallers</code> which has a <code>stringUnmarshaller</code> but it doesn't help. Maybe because this returns type <code>FromEntityUnmarshaller[String]</code> not <code>FromRequestUnmarshaller[String]</code>. There's also a string unmarshaller in <code>spray.httpx.unmarshalling.BasicUnmarshallers</code> but this also doesn't help, neither <code>akka.http.scaladsl.unmarshalling.PredefinedFromStringUnmarshallers</code></p>
  
  <p>How can I unmarshall (and marshall) into a string?</p>
  
  <p>(Bonus: How to unmarshall directly in a JsObject (play json). But also only string as I'm interested in why this is not working and it may be useful for other cases).</p>
  
  <p>Using 1.0-RC3</p>
  
  <p>Thanks.</p>