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

JSON.dump does not work in version 2.7.0 when the argument is an implicit Hash #553

Closed
Uaitt opened this issue Dec 1, 2023 · 5 comments · Fixed by #554
Closed

JSON.dump does not work in version 2.7.0 when the argument is an implicit Hash #553

Uaitt opened this issue Dec 1, 2023 · 5 comments · Fixed by #554

Comments

@Uaitt
Copy link

Uaitt commented Dec 1, 2023

On version 2.6.3

JSON.dump(a:1, b:2, c:3)
#=> "{\"a\":1,\"b\":2,\"c\":3}"

On version 2.7.0

JSON.dump(a:1, b:2, c:3)
ArgumentError: wrong number of arguments (given 0, expected 1..3)

In order to get it to work in 2.7.0 you need to do:

JSON.dump({ a:1, b:2, c:3} )
#=> "{\"a\":1,\"b\":2,\"c\":3}"

The problem lies in this change 978ee15#diff-e08e7b431f64661c031319f3bbbec311665959cd74a86f605975fe62ffe8c93d

@Uaitt Uaitt changed the title JSON.dump does not work anymore when the argument is an implicit Hash JSON.dump does not work in version 2.7.0 when the argument is an implicit Hash Dec 1, 2023
@hsbt
Copy link
Collaborator

hsbt commented Dec 1, 2023

What's your Ruby version?

@Uaitt
Copy link
Author

Uaitt commented Dec 1, 2023

3.2.2 @hsbt

casperisfine pushed a commit to casperisfine/json that referenced this issue Dec 1, 2023
Fix: flori#553

We can never add keyword arguments to `dump` otherwise
existing code using unenclosed hash will break.
@casperisfine
Copy link

I think I have a fix: #554

@hsbt hsbt closed this as completed in #554 Dec 1, 2023
@hsbt
Copy link
Collaborator

hsbt commented Dec 1, 2023

@Uaitt Thank you for your report. I will release 2.7.1 with #554 in next week.

@casperisfine Thanks always ❤️

@Uaitt
Copy link
Author

Uaitt commented Dec 1, 2023

@hsbt and @casperisfine thanks a lot for the quick fix to both of you 😃

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 a pull request may close this issue.

3 participants