Redid the to_json stuff to make compact and correct json data types.

Expanded the function to take file path and write output to file.  Works like a charm now.
cleaning up
Trying to fix the d3footer.html / d3header.html ahead of master message