var obj = {
    x1: {
        x2: {
            x3: {
                condition: false,
                condition_trust: 55.25,
                condition_2 : true,
                condition_2_trust: 56.456
            }
        },
        x4: {
            name: "aaa",
            name_trust: 55.25,
            name_2: "bbb",
            name_2_trust: 96.42
        }
    }
}
I have a tree like this, which is more complex, deeper and bigger. The properties are always on the last level.
What I am trying to do is get all the properties with their values and push them in a new array. Basically I am trying to get an array like this:
array = [
x1_x2_x3_condition : false,
x1_x2_x3_condition_trust : 55.25,
x1_x2_x3_condition_2 : true,
x1_x2_x3_condition_2_trust : 55.456,
x4_name : "aaa",
x4_name_trust : 55.25,
x4_name_2 : "bbb",
x4_name_2_trust : 96.42
]
I have no idea where to start. Any ideas?
 
    