I deal with this all the time with 3rd party APIs. Many of the ones I use return an object of objects, instead of an array of objects like most normal APIs would do.
Annoying, but not a huge deal when you can just loop a for in/of and push the objects to an array - then perform normal array methods on the data.
This post is relevant for anyone working with older/non standard/shitty APIs
This way, backend can do a better indexing for more data processing. Though I am somewhere 85-92% agree of what you said, some of them had their reason. Though supposely when dealing with API to the frontend, I do favours array of objects instead.
Good point. The only apis that return object of objects are old, outdated, and or not maintained in my experience. Which backs up your point - old technology might have needed faster indexing on the backend doing this but now a days just gimme the damn array. 😁
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I deal with this all the time with 3rd party APIs. Many of the ones I use return an object of objects, instead of an array of objects like most normal APIs would do.
Annoying, but not a huge deal when you can just loop a for in/of and push the objects to an array - then perform normal array methods on the data.
This post is relevant for anyone working with older/non standard/shitty APIs
Some API, they prefer putting keys as something that represent the object, such as this
This way, backend can do a better indexing for more data processing. Though I am somewhere 85-92% agree of what you said, some of them had their reason. Though supposely when dealing with API to the frontend, I do favours array of objects instead.
Cheers 😎
Good point. The only apis that return object of objects are old, outdated, and or not maintained in my experience. Which backs up your point - old technology might have needed faster indexing on the backend doing this but now a days just gimme the damn array. 😁