diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index 925eb213c3f547b4495272df67c72616b5b15339..c0bfae70ae996d079c6fc2c28fdf348d8919b333 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -1424,7 +1424,7 @@ class Population:
                 # Write to file
                 ensemble_output = extract_ensemble_json_from_string(ensemble_raw_output)
                 with open(output_file, "w") as f:
-                    f.write(self.format_ensemble_results(ensemble_output))
+                    f.write(json.dumps(self.format_ensemble_results(ensemble_output)))
 
                 print(
                     "Thread {}: Wrote ensemble results directly to file: {}".format(