JSON Body Request to restful service

Hi everybody,

If I want to enable parsing for JSON requests I know I need to configure ‘Request::parsers’

using this class:

‘request’ => [

   'parsers' => [


       'application/json' => 'yii\web\JsonParser',


   ]

]

But where is the correct place to put that fragment of code, I putted in different configuration files inside “component” block but it doesn’t recognize any JSON request that I send.

If some body know how to accomplish this I really appreciate any help.

Thank you.

[ ‘components’ =>

  'request' => [


		'parsers' => [


			'application/json' => 'yii\web\JsonParser',


		]


	],

also, i have extended controller from yii\rest\controller. so i have no idea if it the case. but it should work