Consider the following JavaScript object:
{
"moe": {
    "25-34": {
        "female": {
            "foo": 1747600,
            "bar": 0.17625997236482466
        },
        "male": {
            "foo": 1002100,
            "bar": 0.10107010660722751
        }
    },
    "18-24": {
        "female": {
            "foo": 1104200,
            "bar": 0.11136773946282867
        },
        "male": {
            "foo": 735800,
            "bar": 0.07421154020716296
        }
    }
},
"larry": {
    "18-24": {
        "male": {
            "foo": 2229400,
            "bar": 0.23708698010272988
        },
        "female": {
            "foo": 743800,
            "bar": 0.07909989046398605
        }
    },
    "25-34": {
        "male": {
            "foo": 2092200,
            "bar": 0.22249635766167197
        },
        "female": {
            "foo": 852500,
            "bar": 0.09065966203354142
        }
    },
}
I need to subtract each "bar" value of Moe from Larry, or vice versa - it does not really matter. Each "stooge" node will always have the same properties e.g. 18-24, foo, bar etc however, the number of child items (18-24 etc) will vary and therefore cannot be hard coded. The stooge names will always be different also.
Can anyone advise how I would dynamically subtract the bar values of one object to the other?
UPDATE: there will always be 2 stooges with exactly the same child properties.
 
    