var w    = 960
  , h    = 500
  , svg  = d3.select('body').attr('width', w).attr('height', h).append('svg:svg')
  , defs = svg.append('svg:defs')
  ;

d3.json('icons.json', function(json) {
  var icons = d3.entries(json.icons)
    , count = icons.length
    , icon, i;

  for (icon in json.icons) {
    defs.append('svg:svg')
      .attr('id', icon)
      .attr('svg:viewBox', json.viewbox)
         .append('svg:path')
           .attr('d', json.icons[icon]);
  }

  for (i = 0; icon = icons[i]; i++) {
    svg.append('svg:use')
      .attr('xlink:href', '#'+ icon.key)
      .attr('transform', 'translate('+ (w / (count + 2) * (i + 1)) +','+ (h >> 1) +')')
      .append('svg:title').text(icon.key);
  }
});