read JSON input in slim framework
<p>i am new to slim framework following a tutorial i managed to get post data to my API.but when i tried to send data as JSON it gives me an error.I tried to accpt JSON request as follows what is the correct syntax to achive this.i get error as Required field(s) name, email, password is missing or empty</p>

<pre><code>$app-&gt;post('/login', function() use ($app) {
                // check for required params
                $json = $app-&gt;request-&gt;getBody();
                $data = json_decode($json, true); 
                verifyRequiredParams(array('name','email', 'password'));
</code></pre>

<p>how i can get json data from a post request in my API from an JSON array like </p>

<pre><code>{
"name":"usertest",
"email":"xxxx@xxx.xxx",
"password":"xxxxxx"
}
</code></pre>

<p>can i use <code>verifyRequiredParams(array('name','email', 'password'));</code>  and <code>$name = $app-&gt;request-&gt;post('name');</code> if request come as a JSON.</p>