title: Suddenly getting axios response of nested objects in live server and array of objects in localhost
body: <p>Yesterday my live server <code>axios.get =&gt; response</code> from calling my route <code>/products</code> was an <code>array of objects [{...},{...} ...]</code> .</p>
  <pre><code>axios
      .get(&quot;/products&quot;)
      .then((res) =&gt; {
          setProds(res.data); // output [{...},{...} ...]
      })
      .catch((err) =&gt; {
          console.error(err);
      }); 
  </code></pre>
  <p>Suddenly, this morning the response from the same route <code>/products</code> became an <code>object with objects {&quot;0&quot;: {...}, &quot;1&quot;: {...} ...}</code> <em>only in live server</em>.</p>
  <p>The localhost server, as usual, kept sending an <code>array of objects [{...},{...} ...]</code>.</p>
  <p>Dev server <code>response.data</code></p>
  <pre><code>[
      {
          &quot;id&quot;: 1,
          &quot;name&quot;: &quot;Don Julio 70 700ml&quot;,
          &quot;description&quot;: &quot;Corporis voluptates occaecati commodi illum recusandae dicta laboriosam praesentium molestiae voluptatem perferendis est tenetur non incidunt facere.&quot;,
          &quot;capacity&quot;: null,
          &quot;price&quot;: 650,
          &quot;featured&quot;: 1,
          &quot;img&quot;: &quot;1.jpg&quot;,
          &quot;vap_id&quot;: null,
          &quot;category_id&quot;: 1,
          &quot;discount_id&quot;: null,
          &quot;created_at&quot;: null,
          &quot;updated_at&quot;: null,
          &quot;score&quot;: 0,
          &quot;is_available&quot;: 1,
          &quot;best_seller&quot;: 1
      },
      {
          // product 2
      },
      ... and so on
  ]
  </code></pre>
  <p>Live server <code>response.data</code></p>
  <pre><code>{
      &quot;0&quot;: {
          &quot;id&quot;: 1,
          &quot;name&quot;: &quot;Don Julio 70 700ml&quot;,
          &quot;description&quot;: &quot;&quot;,
          &quot;capacity&quot;: null,
          &quot;price&quot;: 754,
          &quot;featured&quot;: 1,
          &quot;img&quot;: &quot;1.jpg&quot;,
          &quot;vap_id&quot;: null,
          &quot;category_id&quot;: 1,
          &quot;discount_id&quot;: null,
          &quot;created_at&quot;: null,
          &quot;updated_at&quot;: null,
          &quot;score&quot;: 6,
          &quot;is_available&quot;: 1,
          &quot;best_seller&quot;: 0
      },
      &quot;1&quot;: {
          // product data
      },
      &quot;2&quot;: {
          // product data
      }
      ... and so on
  }
  </code></pre>
  <p>This is causing me some problems using <code>map</code> method. And might cause more trouble in future.</p>
  <p>Yeah I could transform the object as I wish, but I can't understand what's causing this since my backend is the same in live and dev server:</p>
  <pre><code>public function index()
  {
      $products = Product::all()
          -&gt;where('is_available', '=', 1)
          -&gt;toArray();
  
      return response()-&gt;json($products, 200); // encode array of arrays to array of objects
  }
  </code></pre>