<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_json(self):
 """Convert the EPW to a dictionary."""

        # load data if it's not loaded
        if not self.is_data_loaded:
            self._import_data()

        def jsonify_dict(base_dict):
            new_dict = {}
            for key, val in base_dict.items():
                new_dict[key] = val.to_json()
            return new_dict
        hot_wks = jsonify_dict(self.extreme_hot_weeks)
        cold_wks = jsonify_dict(self.extreme_cold_weeks)
        typ_wks = jsonify_dict(self.typical_weeks)
        grnd_temps = jsonify_dict(self.monthly_ground_temperature)
        return {
            'location': self.location.to_json(),
            'data_collections': [dc.to_json() for dc in self._data],
            'metadata': self.metadata,
            'heating_dict': self.heating_design_condition_dictionary,
            'cooling_dict': self.cooling_design_condition_dictionary,
            'extremes_dict': self.extreme_design_condition_dictionary,
            'extreme_hot_weeks': hot_wks,
            'extreme_cold_weeks': cold_wks,
            'typical_weeks': typ_wks,
            "monthly_ground_temps": grnd_temps,
            "is_ip": self._is_ip,
            "is_leap_year": self.is_leap_year,
            "daylight_savings_start": self.daylight_savings_start,
            "daylight_savings_end": self.daylight_savings_end,
            "comments_1": self.comments_1,
            "comments_2": self.comments_2
        }