khusamov,
RecursiveIterator / Рекурсивный итератор
<script src="http://nervgh.github.io/js/recursive-iterator.min.js"></script>
<script>
var data = {
items:[{
id: 1
}, {
id: 2,
title: "item2"
}]
}
var iterator = new RecursiveIterator(data),
obj;
for(var item = iterator.next(); !item.done; item = iterator.next()) {
var state = item.value;
if (state.key == "id" && state.node == 2) obj = state.parent
}
alert(JSON.stringify(obj))
</script>