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

Allow the use of strings as loading or saving paths for JSON #126629

Closed
moyanj opened this issue Nov 9, 2024 · 2 comments
Closed

Allow the use of strings as loading or saving paths for JSON #126629

moyanj opened this issue Nov 9, 2024 · 2 comments
Labels
type-feature A feature request or enhancement

Comments

@moyanj
Copy link

moyanj commented Nov 9, 2024

Feature or enhancement

Proposal:

Allow the use of strings as loading or saving paths for JSON.

It maintains the original API, but allows strings to be passed in when passing in file descriptors.This makes it easy to load or save JSON files.

Just like this:

import json

data = {
    "a":"b"
}
json.dump(data, "a.json")  # before: json.dump(data, open("a.json","w"))

I have submitted a pull request. #126626

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

#87623
#85456
#80559

Linked PRs

@moyanj
Copy link
Author

moyanj commented Nov 9, 2024

I have read some discussions about this issue.I think this is a meaningless pull request, so I will close it.

@moyanj moyanj closed this as completed Nov 9, 2024
@Eclips4 Eclips4 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
@nineteendo
Copy link
Contributor

If you still want a convenience function, you can use https://pypi.org/project/jsonyx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants