1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
function iterate(obj, stack) {
console.log("0:" + typeof obj + "; " + obj);
for (var property in obj) {
if (obj.hasOwnProperty(property)) {
if (typeof obj[property] == "object") {
console.log("1:" + typeof obj[property] + "; " + property + " " + obj[property]);
iterate(obj[property], stack + '.' + property);
} else {
console.log("2:" + typeof obj[property] + "; " + property + " " + obj[property]);
}
}
}
}
var DataContract = function () {
this.name = '';
this.cars = [function () {
this.name = '';
this.ruleResult = '';
this.wheels = function () {
this.name = '';
this.inchDiameter = 0;
};
}];
};
var dataContract = new DataContract();
var domDefinition = {
_className : 'DomDefinition',
cars : [{
_className : 'Car',
name : '',
ruleResult : false,
wheels : [{
_className : 'Wheel',
name : '',
inchDiameter : 0
}]
}]
};
iterate(domDefinition, '');
JSON.stringify(domDefinition);