title: Codeigniter4 - return array data as JSON not as XML by default
body: <p>I am just trying to play with the new Codeiginiter4 framework. I have created one route &amp; attached it to one simple method <code>todos</code> which is supposed to return a list of todos(task) as JSON when I try to hit the URL but it returns it as XML format.
  The code is simple,</p>
  
  <pre><code>class Home extends BaseController
  {
      use ResponseTrait;
  
      public function index()
      {
          return view('welcome_message');
      }
  
      public function todos()
      {   
          return $this-&gt;respondCreated(['todos' =&gt; ['task' =&gt; 'Check out new CI4']]);
      }
  
      //--------------------------------------------------------------------
  }
  </code></pre>
  
  <p>// Result</p>
  
  <pre><code>&lt;response&gt;
  &lt;todos&gt;
  &lt;task&gt;Check out new CI4&lt;/task&gt;
  &lt;/todos&gt;
  &lt;/response&gt;
  </code></pre>
  
  <p>Later I discovered that if I explicitly encode the array as JSON(using json_encode) it returns the result as JSON in the browser. Like this,</p>
  
  <pre><code>public function todos()
  {   
      return $this-&gt;respondCreated(json_encode(['todos' =&gt; ['task' =&gt; 'Check out new CI4']]));
  }
  </code></pre>
  
  <p><strong>So my question is there a way to by default return array as JSON format in the browser in CI4?</strong></p>
  
  <p>CI Version I am using: v4.0.2</p>