Skip to content

How to handle inf/nan #21

Description

@rurban

I got this ticket: rurban/Cpanel-JSON-XS#28
"inf and nan encoded as invalid JSON"

I know that inf and nan are not encodable in JSON, but inf or nan are invalid JavaScript.
perl -MJSON -e'print encode_json([9**9**9])'
=> [inf]

Other JSON libraries encode it as null, and Mojo::JSON stepped forward by stringifying it.
I have no opinion, but either one of those solution would be better than the invalid inf or nan,
we currently have.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions