Skip to content
Testaroo
json1.3 KB

Integers Beyond 2^53 in JSON: Silent Identifier Corruption (.json)

Six large integers written both as JSON numbers and as strings, including the 2^53 boundary where consecutive integers stop being distinguishable in a double. A parser backed by doubles turns 9007199254740993 into 9007199254740992 and reports no error at all.

Preview, first 43 linesjson
{
  "note": "JSON numbers have no width. Parsers that use a double lose every id above 2^53.",
  "safe_integer_limit": 9007199254740991,
  "records": [
    {
      "id_as_number": 9007199254740992,
      "id_as_string": "9007199254740992",
      "survives_double": true,
      "value_after_double_round_trip": 9007199254740992
    },
    {
      "id_as_number": 9007199254740993,
      "id_as_string": "9007199254740993",
      "survives_double": false,
      "value_after_double_round_trip": 9007199254740992
    },
    {
      "id_as_number": 9007199254740994,
      "id_as_string": "9007199254740994",
      "survives_double": false,
      "value_after_double_round_trip": 9007199254740994
    },
    {
      "id_as_number": 12345678901234567890,
      "id_as_string": "12345678901234567890",
      "survives_double": false,
      "value_after_double_round_trip": 12345678901234567168
    },
    {
      "id_as_number": 18446744073709551615,
      "id_as_string": "18446744073709551615",
      "survives_double": false,
      "value_after_double_round_trip": 18446744073709551616
    },
    {
      "id_as_number": 1234567890123456789,
      "id_as_string": "1234567890123456789",
      "survives_double": false,
      "value_after_double_round_trip": 1234567890123456768
    }
  ]
}

Specifications

Records
6
Safe Integer Limit
9007199254740991
Largest Value
18446744073709551615
Both Forms Present
id_as_number and id_as_string
Corrupted By Double Parsers
5

Testing contract

Expected to recover
Scenario
Parse the file with your JSON library and compare each id_as_number against the matching id_as_string.
Expected result
A big-integer-aware parser keeps all six pairs in agreement; a double-backed parser disagrees on the four records above 2^53, matching the value_after_double_round_trip column instead.

What is a .json file?

JSON (JavaScript Object Notation) is a lightweight, text-based data-interchange format representing objects, arrays, strings, numbers, booleans, and null. It is language-independent, human-readable, and the dominant format for web APIs and configuration. It requires a single well-formed root value.

How to use this file

Use an example JSON file to test parsers and serializers, schema validation, Unicode and number-precision handling, and API request or response processing.

How to use this file for testing

“Integers Beyond 2^53 in JSON: Silent Identifier Corruption (.json)” is a deterministic Testaroo fixture for Scientific data, Editor testing, Error handling. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS), for testing reference managers, molecule viewers, and scientific-data loaders.

Documented properties for this file: 6 records. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such, expect parsers to fail loudly rather than silently accept them.

Scientific fixtures are small, valid, and fully synthetic, no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.

Code examples

import json

with open("int64-beyond-double-precision.json") as f:
    data = json.load(f)
print(type(data), len(data))

Generated by generation/scientific.py. Free for any use, no attribution required, license.