Json response format incoherence

To make a long story short, let’s consider, single endpoint, single idSite=1, and simple response data.

It looks more or less like that, if there is some data:

{
    "key1": 1,
    "key2": 2
}

otherwise:

{
    "key1": 0,
    "key2": 0
}

In case of plural idSite=1,2, and if in both cases there is some data:

{
    "1": {
        "key11": 11,
        "key12": 12
    },
    "2": {
        "key21": 21,
        "key22": 22
    },
}

but In case of plural idSite=1,2, and in case if some data is missing:

{
    "1": {
        "key11": 11,
        "key12": 12
    },
    "2": [],
}

Our microservice is written in php, but recently, due to our intention to increase the performance, we decided to rewrite it in golang.
php doesn’t have an issue with the last json response snippet, but compiled, statically typed golang - that’s another story.
In case of such an incoherent value data types, you have to resort to unsightly solutions - in my case, parsing json response, and replacing [] with {} to be able to convert json string to the map[string] type - the map[string] values types has to be the same type for all its keys.
For a single idSite you can deal with it, but when you parse a json string of 100, 200, 300,… idSites data, it starts making a difference.

So my question for Matomo Team is if it is possible to make a fix of the format of json response containing non existing data.

Hey, dev team, is it really so difficult to modify your json_encode:

json_encode($data, JSON_FORCE_OBJECT)

?