convert sorted array of string to json tree structure for display as tree
see: http://bl.ocks.org/mbostock/4339083