dump results to a json file if inserting to remote database fails.