var lookup = {},
    result = [];

JSON.parse(value).forEach(function (item) {
    var stage = item.labels.stage;
    if (!(lookup[stage])) {
        lookup[stage] = 1;
        result.push({ "{#STAGE}": stage });
    }
})

return JSON.stringify(result);