title: How to Convert PHP Associative array to json Array
body: <p>I want to convert an associative array in PHP into a a json array but the result is quite different from what i want</p>
  
  <p><strong>PHP Code</strong></p>
  
  <pre class="lang-php prettyprint-override"><code>$output = array(
              "code": "UEX200",
              'email' =&gt; "username@gmail.com",
              'username' =&gt; "username,
              'type'         =&gt; "user",
              'account_manager' =&gt; "manager",
               status'       =&gt; "active
          );
  </code></pre>
  
  <p><strong>i want it to be in this format</strong></p>
  
  <pre><code>{
      "code": "UEX200",
      "details": [{
          "email": "username@gmail.com",
          "username": "username",
          "type": "user",
          "account_manager": "manager",
          "status": "active"
      }]
  }
  </code></pre>
  
  <p><strong>But it outputs in this format</strong></p>
  
  <pre><code>{
      "code": "UEX200",
      "details": {
          "email": "username@gmail.com",
          "username": "username",
          "type": "user",
          "account_manager": "manager",
          "status": "active"
      }
  }
  </code></pre>