diff --git a/DataWriter.py b/DataWriter.py
index b4fee64..a4e6148 100644
--- a/DataWriter.py
+++ b/DataWriter.py
@@ -13,9 +13,10 @@ class DataWriter:
                 relevant output parameters to be written to the JSON file.
         """
 
-        self.metrics = hrm.output_dict
+        self.metrics = self.convert_np_arrays(hrm.output_dict)
         self.csv_file = hrm.csv_file
         output_file = self.get_output_file_name(self.csv_file)
+        self.write_to_json(self.metrics, output_file)
 
     def get_output_file_name(self, csv_file):
         """Finds the root file name (i.e. the file name without the .csv
@@ -38,6 +39,29 @@ class DataWriter:
         output_file = root_file_name + ".json"
         return output_file
 
+    def convert_np_arrays(self, input_dict):
+        """Converts numpy arrays in the input_dict to a regular,
+        serializable python lists, so that the dictionary can be written to
+        a JSON file.
+
+        Parameters
+        ----------
+        input_dict: dict
+                    Expecting a dictionary from the HRM_Processor that has a
+                    numpy array in the 'beats' entry
+        Returns
+        -------
+        serializable_dict:  dict
+                            A dictionary that is equivalent to the
+                            input_dict, but the "beats" entry has been
+                            converted from a numpy array to a dictionary.
+
+        """
+        serializable_dict = input_dict
+        serializable_dict["beats"] = input_dict["beats"].tolist()
+
+        return serializable_dict
+
     def write_to_json(self, metrics, filename):
         """Writes the metrics dictionary to the specified filename as a JSON
         file.

The HRM_Processor writes numpy arrays in the dictionary, which aren't serializable for the DataWriter
The write_outputs_to_dict function in the HRM_Processor writes some of the parameters to the output_dict as numpy arrays. This causes problems when the DataWriter tries to write that dictionary to a JSON file. The DataWriter needs a function that converts the numpy arrays in the metrics dictionary that it reads in, and converts them to regular arrays for outputting to the JSON file. 
diff --git a/conftest.py b/conftest.py
index e86293e..1b7c050 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,6 +1,7 @@
 import pytest
 from DataReader import DataReader
 from HRM_Processor import HRM_Processor
+from DataWriter import DataWriter
 
 
 @pytest.fixture
@@ -17,3 +18,12 @@ def hrm(dr):
 
     hrm = HRM_Processor(dr)
     return hrm
+
+
+@pytest.fixture
+def dw():
+    """Create a basic DataWriter object"""
+    dr_for_DW = DataReader('test_data1.csv')
+    hrm_for_DW = HRM_Processor(dr_for_DW)
+    dw = DataWriter(hrm_for_DW)
+    return dw
diff --git a/test_DataWriter.py b/test_DataWriter.py
index 49f1785..b85a0f1 100644
--- a/test_DataWriter.py
+++ b/test_DataWriter.py
@@ -1,5 +1,9 @@
-from DataWriter import DataWriter
 import json
+import numpy as np
+import os
+from DataReader import DataReader
+from HRM_Processor import HRM_Processor
+from DataWriter import DataWriter
 
 
 def test_DataWriter_init(hrm):
@@ -21,6 +25,23 @@ def test_DataWriter_init(hrm):
     assert dw.metrics == hrm.output_dict
 
 
+def test_DataWriter_init_write_to_dict():
+    """Tests that the construction of a DataWriter object creates a .json
+    file with the base file name that is the same as the file name of the
+    .csv file passed into the original DataReader.
+
+    Returns
+    -------
+    None
+    """
+    dr = DataReader("test_data1.csv")
+    hrm = HRM_Processor(dr)
+    dw = DataWriter(hrm)
+
+    assert os.path.isfile("test_data1.json")
+    os.remove("test_data1.json")
+
+
 def test_write_to_json(hrm):
     """Tests the write_to_json function of the DataWriter, which should be
     able to take in an dictionary and output file path, and write that
@@ -46,3 +67,24 @@ def test_write_to_json(hrm):
         written_data = json.load(infile)
 
     assert written_data == metrics
+
+
+def test_convert_np_arrays(dw):
+    """Tests that the convert_np_arrays function finds the beats entry in
+    teh dictionary and converts it from a numpy array to a python list.
+
+    Parameters
+    ----------
+    dw:     DataWriter
+            A generic DataWriter object made from an original DataReader /
+            HRM_Processor with the file test_data1.csv.
+
+    Returns
+    -------
+    None
+    """
+    metrics_dict = {}
+    metrics_dict["beats"] = np.array([1, 2, 3, 4])
+    serializable_dict = dw.convert_np_arrays(metrics_dict)
+
+    assert isinstance(serializable_dict["beats"], list)

pip install -r requirements.txt
parse_log_pytest
requirements.txt
pytest
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
numpy==2.0.2
packaging==24.2
pep8==1.7.1
pluggy==1.5.0
pytest==8.3.5
pytest-cache==1.0
pytest-cov==6.0.0
pytest-pep8==1.0.6
tomli==2.2.1

name: bme590hrm
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - iniconfig==2.1.0
      - numpy==2.0.2
      - packaging==24.2
      - pep8==1.7.1
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cache==1.0
      - pytest-cov==6.0.0
      - pytest-pep8==1.0.6
      - tomli==2.2.1
prefix: /opt/conda/envs/bme590hrm

test_DataWriter.py::test_DataWriter_init_write_to_dict test_DataWriter.py::test_convert_np_arrays
test_DataWriter.py::test_DataWriter_init test_DataWriter.py::test_write_to_json
DataWriter.py
DataWriter.py