title: Extracting Raw JSON as String inside a Spray POST route
body: <p>I've a POST Spray route and the request contains a JSON body (content-type "application/json"). I want a way to extract the raw JSON from this request inside my route. </p>
  
  <p>For <a href="http://host:port/somepath/value1">http://host:port/somepath/value1</a> I want to <em>extract</em> the post body as <code>TextMsgResponse</code>. But for <a href="http://host:port/somepath/value2">http://host:port/somepath/value2</a> I want to <em>extract</em> the post body just as a raw Json (e.g., <code>{ "name":"Jack", "age":30 }</code> </p>
  
  <pre><code>val myRoute = path("somepath" / Segment) { pathSegment =&gt; 
  post {   //use only POST requests
    pathSegment match {
      case "value1" =&gt;
        entity(as[TextMsgResponse]) { textMsg =&gt;
          complete {
            //do something with the request
            StatusCodes.OK
          }
        } 
      case "value2" =&gt; { 
         //here is I want to extract the RAW JSON from the request          
        } 
      }
     }
  </code></pre>