I need help with removing a property from a Javascript object. It looks like this:
devices = {
    device1 : {
        properties : {
            name : {
                value : "ABC"
            },
            id: {
                value : "1234"
            }
        }
    },
    device2 : {
        properties : {
            id: {
                value : "5678"
            }
        }
    }
};
I now get a path for the property to delete:
var path_str = "device1___properties___name___value";
I split it to an array:
var path = path_str.split("__");
When the parent (or parent's parent... to top) is containing only the single element, it should be removed too.
So deleting "device1___properties___name___value" would keep "device1___properties___*", 
but deleting "device2___properties___id___value" would remove "device2" property completely, keeping only other "device*" properties.
 
    