3 ms·
I've regretted designing APIs that return an array rather than an object in the past. It's all about the extensibility. If you return an object you can add ext
by simonw 2y ago
I've regretted designing APIs that return an array rather than an object in the past.
It's all about the extensibility. If you return an object you can add extra keys, for things like "an error occurred, here are the details", or "this is truncated, here's how to paginate it", or a logs key for extra debug messages, or information about the currently authenticated user.
None of those are possible if the root is an array.