def to_json(self):
<EOL>if not self.is_data_loaded:<EOL><INDENT>self._import_data()<EOL><DEDENT>def jsonify_dict(base_dict):<EOL><INDENT>new_dict = {}<EOL>for key, val in base_dict.items():<EOL><INDENT>new_dict[key] = val.to_json()<EOL><DEDENT>return new_dict<EOL><DEDENT>hot_wks = jsonify_dict(self.extreme_hot_weeks)<EOL>cold_wks = jsonify_dict(self.extreme_cold_weeks)<EOL>typ_wks = jsonify_dict(self.typical_weeks)<EOL>grnd_temps = jsonify_dict(self.monthly_ground_temperature)<EOL>return {<EOL>'<STR_LIT:location>': self.location.to_json(),<EOL>'<STR_LIT>': [dc.to_json() for dc in self._data],<EOL>'<STR_LIT>': self.metadata,<EOL>'<STR_LIT>': self.heating_design_condition_dictionary,<EOL>'<STR_LIT>': self.cooling_design_condition_dictionary,<EOL>'<STR_LIT>': self.extreme_design_condition_dictionary,<EOL>'<STR_LIT>': hot_wks,<EOL>'<STR_LIT>': cold_wks,<EOL>'<STR_LIT>': typ_wks,<EOL>"<STR_LIT>": grnd_temps,<EOL>"<STR_LIT>": self._is_ip,<EOL>"<STR_LIT>": self.is_leap_year,<EOL>"<STR_LIT>": self.daylight_savings_start,<EOL>"<STR_LIT>": self.daylight_savings_end,<EOL>"<STR_LIT>": self.comments_1,<EOL>"<STR_LIT>": self.comments_2<EOL>}<EOL>
Convert the EPW to a dictionary.