Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve writing JSON file method. #507

Merged
merged 2 commits into from
Apr 29, 2024
Merged

Improve writing JSON file method. #507

merged 2 commits into from
Apr 29, 2024

Conversation

jfreissmann
Copy link
Collaborator

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.

@jfreissmann jfreissmann requested a review from fwitte April 29, 2024 07:51
@fwitte
Copy link
Member

fwitte commented Apr 29, 2024

Thanks a lot for the contribution! :)

@fwitte fwitte merged commit b77e844 into oemof:dev Apr 29, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants