I have an array like this:

```
[
    {
        "function_1": {
            "element": {
                "error": "0",
                "msg": "test"
            }
        }
    },
    {
        "function_1": {
            "element_2": {
                "error": "0",
                "msg": "test"
            }
        }
    },
    {
        "function_2": {
            "element": {
                "error": "0",
                "msg": "test"
            }
        }
    },
    {
        "function_2": {
            "element_2": {
                "error": "0",
                "msg": "test"
            }
        }
    }
]

```

I want output like this:

```
[
    {
        "function_1": {
            "element": {
                "error": "0",
                "msg": "test"
            },
            "element_2": {
                "error": "0",
                "msg": "test"
            }
        }
    },
    {
        "function_2": {
            "element": {
                "error": "0",
                "msg": "test"
            },
            "element_2": {
                "error": "0",
                "msg": "test"
            }
        }
    }
]

```

The answers that I found offered to search by name("function\_1", "function\_2"). But this does not suit me, the function will not always pass an array. I need exactly the "depth" or any other reasonable way.
Thank you!