title: Get query result column value of tinyint as true/false in codeigniter
body: <p>I have column in <code>my_table</code> which has datatype of tinyint <br> <a href="https://i.stack.imgur.com/PwkA5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PwkA5.jpg" alt="a column of table contains tinyint datatype"></a></p>
  
  <p>CodeIgniter model class:</p>
  
  <pre><code>public function get_all() {
      $query = $this-&gt;db-&gt;get('my_table');
      return $query-&gt;result();
  }
  </code></pre>
  
  <p>query result return the value of is_active field as a string "0" / "1". I want it as true/false. So that, json data of that field is true/false. <br>
  Controller class:</p>
  
  <pre><code>$query_result = $this-&gt;model-&gt;get_all();
  echo json_encode($query_result);
  </code></pre>
  
  <p>How I get this?</p>
  
  <p><strong>UPDATE:</strong>
  query result array is:</p>
  
  <pre><code>Array (
  [0] =&gt; stdClass Object
      (
          [brand_id] =&gt; 1014
          [brand_name] =&gt; Coca Cola
          [brand_logo] =&gt; coca_cola_logo2.png
          [is_active] =&gt; 1
      )
  
  [1] =&gt; stdClass Object
      (
          [brand_id] =&gt; 1015
          [brand_name] =&gt; Hallmark
          [brand_logo] =&gt; hallmark_logo.jpg
          [is_active] =&gt; 0
      )
  
  [2] =&gt; stdClass Object
      (
          [brand_id] =&gt; 1016
          [brand_name] =&gt; Binjar
          [brand_logo] =&gt; binjar3.png
          [is_active] =&gt; 1
      )
  
  )
  </code></pre>