var array = [{ "type": "people", "name": "chen", "sex": "男", "age": 30, "objects": [{ "type": "people", "name": "chen", "sex": "男", "age": 31 }, { "type": "people", "name": "chen", "sex": "男", "age": 32 }] }, { "type": "people", "name": "chen", "sex": "男", "age": 33, }, { "type": "people", "name": "chen", "sex": "男", "age": 34, "objects": [{ "type": "people", "name": "chen", "sex": "男", "age": 35 }] }]; var ageAll = []; var findAge = function(arr) { arr.forEach(function(item) { if (item.age) { ageAll.push(item.age); } if (item.objects && item.objects.length > 0) { findAge(item.objects); } }); } findAge(array); console.log(ageAll);