title: How to return a plain object rather than an array of object
body: <p>I am getting a single record response with php script below</p>
  <pre><code>&lt;?php
  header('Content-Type: application/json');
  include &quot;db.php&quot;;
  
  $uid = 1;
  
  $stmt = $db-&gt;prepare(&quot;SELECT * FROM transaction WHERE isAdmin = ?&quot;);
  
  $stmt-&gt;execute([$uid]);
  
  $result = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
  
  echo json_encode(
      [
      'status' =&gt;'success',
      'message' =&gt; $result,
      ]);
  </code></pre>
  <p>I get a response of</p>
  <pre><code>{
      &quot;status&quot;: &quot;success&quot;,
      &quot;message&quot;: [
          {
              &quot;s_n&quot;: &quot;1&quot;,
              &quot;email&quot;: &quot;seeme@mail.com&quot;,
              &quot;info&quot;: &quot;Good morning&quot;,
              &quot;isAdmin&quot;: &quot;1&quot;
          }
      ]
  }
  </code></pre>
  <p>But I want a response of</p>
  <pre><code>   {
          &quot;status&quot;: &quot;success&quot;,
          &quot;message&quot;: 
              {
                  &quot;s_n&quot;: &quot;1&quot;,
                  &quot;email&quot;: &quot;seeme@mail.com&quot;,
                  &quot;info&quot;: &quot;Good morning&quot;,
                  &quot;isAdmin&quot;: &quot;1&quot;
              }
      }
  </code></pre>
  <p>How can I get the object response, instead of the array object response?</p>