write json back to file