Skip to content

Identity filter increments large integer values unexpectedly #2131

Closed
@wdh

Description

@wdh

Input:
$ echo '{"variantId":24092600057481699}' | jq '.'

Actual output:

{
  "variantId": 24092600057481700
}

Expected output:

{
  "variantId": 24092600057481699
}

Notes:

  • The issue seems to be related to the size of the integer - it does not happen if the leading digit is removed.
  • Expected output is based on man jq, which says it should be unchanged:
BASIC FILTERS
   Identity: .
       The absolute simplest filter is . . This is a filter that takes its input and produces it unchanged as output. That is, this is the identity operator.

Environment:

  • MacOS Mojave 10.14.6 (18G4032)
  • jq 1.6 (installed via Homebrew)
$ brew info jq
jq: stable 1.6 (bottled), HEAD
Lightweight and flexible command-line JSON processor
https://stedolan.github.io/jq/
/usr/local/Cellar/jq/1.6 (18 files, 1MB) *
  Poured from bottle on 2020-01-20 at 11:22:05
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jq.rb
==> Dependencies
Required: oniguruma ✔
==> Options
--HEAD
        Install HEAD version
==> Analytics
install: 37,670 (30 days), 122,484 (90 days), 456,202 (365 days)
install-on-request: 36,632 (30 days), 119,189 (90 days), 442,258 (365 days)
build-error: 0 (30 days)

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