Skip to content

Improve JSON.load and JSON.unsafe_load to allow passing options as second argument#910

Merged
byroot merged 1 commit into
ruby:masterfrom
byroot:load-options
Dec 3, 2025
Merged

Improve JSON.load and JSON.unsafe_load to allow passing options as second argument#910
byroot merged 1 commit into
ruby:masterfrom
byroot:load-options

Conversation

@byroot

@byroot byroot commented Dec 3, 2025

Copy link
Copy Markdown
Member

Otherwise it's very error prone.

I'm experimenting with what json 3.0 will be like with the create_additions remove, and JSON.load no longer considered unsafe.

This came up as a footgun.

…s second argument

Otherwise it's very error prone.
@byroot byroot merged commit c54de70 into ruby:master Dec 3, 2025
37 checks passed
@eregon

eregon commented Dec 3, 2025

Copy link
Copy Markdown
Member

If the options were keyword arguments that wouldn't need to be handled explicitly, but maybe that's not compatible enough if people pass a positional* Hash for options?

@byroot

byroot commented Dec 3, 2025

Copy link
Copy Markdown
Member Author

but maybe that's not compatible enough if people pass a position Hash for options?

Yeah, it's on my list of things to do. I want to migrate to keyword args, but quite unsure how much compatibility I'll break. I'll definitely do it for 3.0 if I can't find a deprecation path first though.

@byroot byroot deleted the load-options branch December 3, 2025 15:15
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