Data:
var data = [ { \"id\": 1, \"level\": \"1\", \"text\": \"Sammy\", \"type\": \"Item\", \"items\": [
another way with recursive reducer function
_.reduce(data, function reducer(result, val) { var items = _.reduce(val.items, reducer, []); val.items = _.isArray(val.items) ? [] : val.items; return _.concat(result, val, items); }, []);