var input = JSON.parse(value),
    output = [];

Object.keys(input).forEach(function (upstream) {
    input[upstream].peers.forEach(function (peer) {
        output.push({ '{#UPSTREAM}': upstream, '{#PEER}': peer.server })
    });
});

return JSON.stringify(output);

