title: Access body as JSON in ActionBuilder
body: <p>I'm using Playframework 2.3.X. I'm trying to construct an action function that validates fields in a JSON request.body. The use case is to build "blocks" of validation that I can then chain together.</p>
  
  <p>However, I can't seem to access the request.body as a JSON inside the action builder. The following doesn't compile. The compiler can't resolve "asJson":</p>
  
  <pre><code>def ValidateJsonBodyAction = new ActionBuilder[Request] {
  
     def invokeBlock[A](request: Request[A], block: (Request[A]) =&gt; Future[Result]): Future[Result] = {
  
         val body= request.body.asJson
     }
  }
  </code></pre>
  
  <p>UPDATE: It could also be that I'm approaching this the wrong way. I'm new to play, so alternative approaches are also welcome.</p>
  
  <p>UPDATE: Yes, it appears that a may be doing things the wrong way. I'm not the only one with this issue. See <a href="https://github.com/playframework/playframework/issues/3387" rel="nofollow">https://github.com/playframework/playframework/issues/3387</a></p>