title: How do I parse JSON requests in my Play project
body: <p>I am building a simple web server with Scala + Play.  I am having trouble figuring out how to accept and deserialize JSON requests into objects of my predefined types.  I need help 1) downloading a well-supported JSON package, 2) importing the package in my code to parse the HTTP requests, and 3) actually parsing some JSON.</p>
  
  <p>Here is what I am putting in my SBT file for #1:</p>
  
  <pre><code>libraryDependencies += "org.json4s" %% "json4s-native" % "3.2.9"
  </code></pre>
  
  <p>Here's how I'm trying to import it for #2:</p>
  
  <pre><code>import org.json4s._
  import org.json4s.native.JsonMethods._
  </code></pre>
  
  <p>Here's where I try to parse some JSON in my action:</p>
  
  <pre><code>package controllers
  
  import play.api._
  import play.api.mvc._
  import play.api.libs.json.Json
  import org.json4s._
  import org.json4s.native.JsonMethods._
  
  object Application extends Controller {
    case class Credentials(username: String, password: String)
  
    def login = Action { request =&gt;
        Ok(Json.obj("message" -&gt; "You tried to log in as: " + parse(request.body).extract[Credentials].username))
    }
  }
  </code></pre>
  
  <p>Can anyone tell me what I am doing wrong?  I am getting an error at runtime which says: "play.PlayExceptions$CompilationException: Compilation error[controllers.Application.parse.type does not take parameters]"</p>