file i/o infrastructure to save json