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

Mojo::JSON: encode core boolean values as json bools #2192

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

haarg
Copy link
Contributor

@haarg haarg commented Aug 9, 2024

Summary

Encode perl's built in boolean values on perl 5.36 and newer

Motivation

Newer perl versions can track if a value is a boolean rather than just a string or number. Since we can identify them as being booleans, they can be encoded in JSON as booleans. This also matches the behavior of newer versions of JSON::PP and Cpanel::JSON::XS

References

Fixes #2191

On perl 5.36 and newer, perl's own boolean values can be identified as
being booleans. Encode them as JSON boolean values when possible.
Copy link
Member

@christopherraa christopherraa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@kraih kraih merged commit 6330775 into mojolicious:main Aug 13, 2024
11 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.

Mojo::JSON, without Cpanel::JSON::XS, doesn't encode booleans correctly in Perl v5.40
3 participants