fixed up exporting and added functions for table to json operations