Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Fetching api returns Array of Arrays instead Array of Objects

I am a Front end developer and I am working on a project which requires CRUD operations, I came to the point in which I have to fetch data from an API. I tested the API in Postman and Arc, the data is coming out fine as it should (Array of objects), but when I fetch in the app either with Axios or with Fetch the data I get is, Array of Arrays, this never happened and I could use the help.

axios
.get(
  "***$format=json",
  { withCredentials: "true" }
)
.then((data) => {
  console.log(data, "data");
})
.catch((err) => console.log(err, "err"));

Console log

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I have seen the consol log and it seems that it is an Array of Object only but the length of the array is 1823 so chrome changed the way of showing, it just made groups of 100 arrays so if you just try to iterate through the response using .map method then you will find out that actually, it is an array of object

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading