Skip to content

Handle NaN values too #316

@bedilbek

Description

@bedilbek

Expected

cat <<EOF > sample.json | jq . 
{
  "key": NaN 
}
EOF
{
  "key": null
}

Actual

cat <<EOF > sample.json | jaq .
{
  "key": NaN 
}
EOF
Error: failed to parse: value expected

Could you also handle this case? This kind of use case typically occurs when I use Python's default JSON encoder for numpy.nan values. Example:

uv run --with numpy~=2.3.2 python -c 'import numpy as np; import json; print(json.dumps(np.nan))'
NaN

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