title: How to get JSON from one parameter of request in Laravel
body: <p>I want to send a stringified JSON to one of the fields of an API request like following:</p>
  
  <p>Decoded:</p>
  
  <pre><code>https://api.some.com/foo/bar?a=788&amp;b=My Name&amp;c=[{"name":"pejman"},{"Some":"thing"}]
  </code></pre>
  
  <p>I want to get <code>c</code> parameter using <code>$request-&gt;c</code> but I want to get it as a decoded JSON automatically in my controller.</p>
  
  <p>This is my PHP code</p>
  
  <p><strong>MyRequest.php</strong>:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  use InfyOm\Generator\Request\APIRequest;
  
  class MyRequest extends APIRequest
  {
      public function authorize()
      {
          return true;
      }
  
      public function rules()
      {
          return [
              'a' =&gt; 'required',
              'b' =&gt; 'required',
              'c' =&gt; 'requried',
          ];
      }
  }
  
  </code></pre>
  
  <p><strong>SomeController.php</strong>:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  class SomeController extends Controller
  {
  
      public function store(MyRequest $request)
      {
          $c = $request-&gt;c;
          $c = $request-&gt;json('c');
          $c = $request-&gt;json()-&gt;all();
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p><strong> I want <code>$c</code> to be a JSON decoded automatically in my controller, How can I do that? Is that event possible to do this using <code>MyReqest</code> and how?</strong></p>
  </blockquote>