allow raw output to be written to file; support raw output formats json and pickle