oemof / tespy

Thermal Engineering Systems in Python (TESPy). This package provides a powerful simulation toolkit for thermal engineering plants such as power plants, district heating systems or heat pumps.
https://tespy.readthedocs.io
MIT License
256 stars 80 forks source link

Improve writing JSON file method. #507

Closed jfreissmann closed 2 months ago

jfreissmann commented 2 months ago

General

When writing JSON data to a file, the json.dumps method is used to create a string in JSON format, which is then written to disk with the write method of the file object. The extra conversion is not necessary, since the json.dump method directly writes the data to the file, without the extra step of converting the data to a string. See for example this comparison on StackOverflow or the json module documentation.

fwitte commented 2 months ago

Thanks a lot for the contribution! :)