Thread:Fngplg/@comment-9605025-20200312153227

Thread:1822538

I am moving the conversation here so that it doesn't derail the other thread too much if this discussion continues.

I am aware that if you don't know which is which then you need iterate but sometimes that doesn't matter. Knowing which is which only matters if you are trying to traverse them in a certain order or access a specific one but not the others. In that case, if you happen to already have the pageid, then the keys are helpful. However, there are at least just as many ways to get the response object without knowing pageids; so you need to extract them from the object. Then if order doesn't matter, you still need to extract the keys to access the data. I guess the way I see it is that using pageids as the keys is useful in some situations but there are just as many if not more in which using an array makes more sense.

So perhaps the API designers had a specific use case in mind and using pageids as keys makes sense for that. Okay, fine. At least that reason is better than "why not?". I would also like to point out that I said "site/program". I am green when it comes to websites but I have worked with a lot of code for scientific analysis for a while. For some reason, in that community, people still like using objects over arrays when it makes no sense at all. Perhaps that isn't the case for the web devs and I am just incorrectly transferring my knowledge about how JSONs are used in one field to a different field. 