title: Cannot use object of type Illuminate\\Http\\JsonResponse as array in Laravel
body: <p>i have data of set like this:</p>
  <pre><code>$data[] =
  Array
  (
      [u_d] =&gt; ABCDEF
      [0] =&gt; Array
          (
          [one] =&gt; oned
          [two] =&gt; 222
          [three] =&gt; three
          [four] =&gt; 444
          [five] =&gt; 555
          [events] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [feed] =&gt; Array
                              (
                                  [0] =&gt; Array
                                      (
                                          [date-time] =&gt; 191018080000
                                          [sub-type] =&gt; abc
                                          [comments] =&gt; test comments
                                          [parameter-list] =&gt; para1, para2
                                          [state] =&gt; bad
                                          [value] =&gt; 1000
                                      )
  
                              )
  
                      )
  
              )
          )
  
  
      [1] =&gt; Array
          (
              [one] =&gt; two
              [two] =&gt; 224562
              [three] =&gt; thyyree
              [four] =&gt; 445344
              [five] =&gt; 5345355
              [events] =&gt; Array
                  (
                  )
  
          )
  )
  </code></pre>
  <p>I need to fetch the event only and remove the empty events. However first i tried to fetch the events liket this, But it give an error.</p>
  <pre><code>                               $new = [];
                                   for($i=0 ; $i &lt; count($data)-1 ; $i++)
                                  {
                                    if(count($data[$i]['events']) &gt; 0)
                                    {
                                      
                                      $new[] = $data[$i]['events'];
                                     
                                    }
                                    
                                  }
                                  print_r ($new);
  </code></pre>
  <p>But it give me an error : Cannot use object of type Illuminate\Http\JsonResponse as array</p>
  <p>Can anyone please help me to resovle the issue?</p>
  <p>Thank you</p>