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

Provide a load_file method like YAML's #386

Closed
keithrbennett opened this issue Oct 22, 2019 · 1 comment
Closed

Provide a load_file method like YAML's #386

keithrbennett opened this issue Oct 22, 2019 · 1 comment

Comments

@keithrbennett
Copy link
Contributor

One very common use case is to need to parse the contents of a JSON file.

As far as I know, this can only be accomplished in 2 steps, e.g. JSON.parse(File.read('something.json')).

YAML provides a convenient load_file method that combines these two. Obviously, it is trivially simple to implement.

Could we get a similar method (preferably with the same name) in this JSON library?

keithrbennett added a commit to keithrbennett/json that referenced this issue Oct 22, 2019
keithrbennett added a commit to keithrbennett/json that referenced this issue Oct 24, 2019
keithrbennett added a commit to keithrbennett/json that referenced this issue Jun 25, 2020
keithrbennett added a commit to keithrbennett/json that referenced this issue Jun 25, 2020
keithrbennett added a commit to keithrbennett/json that referenced this issue Jun 25, 2020
keithrbennett added a commit to keithrbennett/json that referenced this issue Jun 30, 2020
hsbt added a commit that referenced this issue Jun 30, 2020
Add `load_file` and `load_file!` methods, with tests. Fixes issue #386.
@hsbt
Copy link
Member

hsbt commented May 27, 2021

#387 was merged now.

@hsbt hsbt closed this as completed May 27, 2021
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

No branches or pull requests

2 participants