It might be worthwhile to generalize it and just push the original JSON record onto the list. That way the code doesn't need to change if you later need to pass more than title and link.
var categories = {}, groupBy = "CATEGORY"; $.each(myData.records, function(i, record) { if (!categories[record[groupBy]]) categories[record[groupBy]] = []; categories[record[groupBy]].push(record); });