Skip to content

How to handle inf/nan #21

@rurban

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.

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