Q: How to get data in Laravel using POST method in JSON Object? here is my route.php
Route::post('users' , array('uses'  => 'Userscontroller@index'));

This is my Userscontroller.php
public function index()
    {
        $email_id = Input::get('email_id');
        $name = Input::get('name');

        return $email_id. ' ' .$name;
    }

When i run this in postman I get error as 

'>' unexpected in JSON

.
Where m I missing?
Thank You.

A: if you send json like this:
{"user":{"name":"abc","code":134}}

in laravel controller:
$data =  $request->json()->all(); //read json in request
return response()->json($data);  //send json respond


A: Maybe you're looking for something like this:
public function index()
{
   //if you want to get json data in your controller do this:
    Request::json()->all();

    //Return json data to your view script like this:
    return response()->json(['email_id'=>$email_id, 'name'=>$name]);
}


A: Try This:
 public function index(Request $request)
    {
       $dataArray = $request->get('data');
       $data = json_decode($dataArray, true);
       return 'Name: '.$data['name'].', Email: '.$data['email_id'];
    }

Send your data into data tag.
