Skip to content

Inconsistent behavior with NaN #2021

Closed
@gahag

Description

@gahag

Describe the bug
Jq does not accept nan, but accepts -nan.

To Reproduce

echo nan | jq .
parse error: Invalid literal at line 2, column 0

echo -nan | jq .
null

echo NaN | jq .
null

echo -NaN | jq .
null

Expected behavior
Not sure if jq should accept nan, or reject -nan. I would vote for rejecting -nan, as some popular applications like MongoDB do.

Environment (please complete the following information):

  • OS: Kubuntu 19.04
  • jq version: jq-1.5-1-a5b5cbe

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions