title: Is there a better way to return a .json array for ajax in php?
body: <p>I have a huge array of data in json format such as the shortened example below. And the only way to have the desired result was to encode and then decode, which seems quite absurd to me. 
  I can't find myself a better way to code this, i hope you can help me out</p>
  
  <pre><code>$exDummy= '[{"ID":"149467","date":"2018-03-23","name":"Bill", },
  {{"ID":"149445","date":"2018-03-25","name":"Joe", },
  {{"ID":"168841","date":"2018-04-05","name":"Lily", }]';
  
  // This is how i actually solved it. But i dont think its the proper way.
  $exDummy = json_decode($exDummy);
  return JwtCheckHeader::json($exDummy);
  </code></pre>
  
  <p>So im basically asking if there is a direct way to return this without this workaround.</p>
  
  <p>I've tried these solutions which should return json but none worked. I'm looking for something similar to the following</p>
  
  <pre><code>return JwtCheckHeader::json($exDummy);
  echo json_encode($exDummy);
  echo $exDummy;
  return $exDummy;
  </code></pre>
  
  <p>(return type was set in the ajax call)
  Edited for clarification</p>