API Response formatting: nested vs keyed

Hi everyone,

I understand that a lot of Mautics API responses are formatted in an associative array format. Contacts, companies, etc. They are formatted like this:
"contacts":{"1":{...}, "2":{...}}
Instead of:
"contacts":[{"id": "1", ...},{"id": "1", ...}]

However, I’m working with MS Power Automate for a lot of integrations, and it doesn’t really like this kind of format. The responses need to be converted to XML and then I can use XPath to get the info I need.

Why are responses formatted in this way? And why are all responses in a different format? Contact Activities for example, are formatted in a normal nested array:
{ “events”: [
{ “event”: “lead.source.created”, “eventId”: “lead.source.created19348”},
{ “event”: “lead.source.created”, “eventId”: “lead.source.created19349”}
]}

IF I would want to make changes to the way these array are formatted, in what part of the repo should I look? I’ve been looking into the API controllers and Serialization, but can’t seem to find where the decision is made per entity.