I am complete beginner in programming can anyone help me to get this object as array?

//We have a nested json that should be converted as array

json =

{
    x: "dfsd",
    y: "asdasd",

    z: [{
        x: "dfsd",
        y: "asdasd",

        z: [{
            x: "dfsd",
            y: [
                {
                    x: "dfsd",
                    y: "asdasd"
                }
            ],
        }]
    }]
}

expected as array =

[
    {x:"dfsd",y:"asdasd"},
    {x:"dfsd",y:"asdasd"}
]