This is just a quick tip for everybody currently designing an api.
I have seen something like that very very often:
Always return something like that instead:
The reason is pretty simple. While you can easily iterate over the object keys in dynamically types languages like javascript, it's not that easily doable in statically typed languages. For example when consuming such an api in c#, you want to serialize the response directly in instances of classes that you already defined. Dynamic keys are the worst for that.
So please please please, never use dynamic keys in an api.
Top comments (0)