title: Convert object to associative array returns null value
body: <p>I am calling a magento soap v2 api and in return geting a respone with an object which I am trying to convert in associative array. But when I am trying to do that with json encode /decode method it is returning an null array.</p>
  
  <pre><code>$result = Magento::call()-&gt;catalogProductList();
  $array = json_decode(json_encode($result), true);
  </code></pre>
  
  <p>1)The object is not empty.
  2) Type casting is not an option for me because I am trying to avoid prepending *.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>this the result value which I am trying to encode.</p>
  
  <pre><code>    Tinyrocket\Magento\Objects\MagentoObjectCollection Object
      (
          [collection:protected] =&gt; Array
              (
                  [0] =&gt; Tinyrocket\Magento\Objects\MagentoObject Object
                      (
                          [data:protected] =&gt; Array
                              (
                                  [product_id] =&gt; 9
                                  [sku] =&gt; Tilapia
                                  [name] =&gt; Tilapia
                                  [set] =&gt; 4
                                  [type] =&gt; simple
                                  [category_ids] =&gt; Array
                                      (
                                          [0] =&gt; 2
                                          [1] =&gt; 4
                                      )
  
                                  [website_ids] =&gt; Array
                                      (
                                          [0] =&gt; 1
                                      )
  
                              )
  
                      )
  
                  [1] =&gt; Tinyrocket\Magento\Objects\MagentoObject Object
                      (
                          [data:protected] =&gt; Array
                              (
                                  [product_id] =&gt; 10
                                  [sku] =&gt; Deshi Rui
                                  [name] =&gt; Deshi Rui
                                  [set] =&gt; 4
                                  [type] =&gt; simple
                                  [category_ids] =&gt; Array
                                      (
                                          [0] =&gt; 2
                                          [1] =&gt; 4
                                      )
  
                                  [website_ids] =&gt; Array
                                      (
                                          [0] =&gt; 1
                                      )
  
                              )
  
                      )
  
  ...
  ...
  </code></pre>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>output of var_export($result)</p>
  
  <pre><code>Tinyrocket\Magento\Objects\MagentoObjectCollection::__set_state(array(
     'collection' =&gt; 
    array (
      0 =&gt; 
      Tinyrocket\Magento\Objects\MagentoObject::__set_state(array(
         'data' =&gt; 
        array (
          'product_id' =&gt; '9',
          'sku' =&gt; 'Tilapia',
          'name' =&gt; 'Tilapia',
          'set' =&gt; '4',
          'type' =&gt; 'simple',
          'category_ids' =&gt; 
          array (
            0 =&gt; '2',
            1 =&gt; '4',
          ),
          'website_ids' =&gt; 
          array (
            0 =&gt; '1',
          ),
        ),
      )),
      1 =&gt; 
      Tinyrocket\Magento\Objects\MagentoObject::__set_state(array(
         'data' =&gt; 
        array (
          'product_id' =&gt; '10',
          'sku' =&gt; 'Deshi Rui',
          'name' =&gt; 'Deshi Rui',
          'set' =&gt; '4',
          'type' =&gt; 'simple',
          'category_ids' =&gt; 
          array (
            0 =&gt; '2',
            1 =&gt; '4',
          ),
          'website_ids' =&gt; 
          array (
            0 =&gt; '1',
          ),
        ),
      )),
  
     'count' =&gt; 2,
  ))
  </code></pre>