← Diggwigs field notes

The integer that changed before you touched it

A service emits the event ID 9007199254740993. You parse the payload and print it again. The last digit changes. The source was syntactically valid; converting its number into a JavaScript Number lost the distinction.

Inspect the original token

Open JSON Inspector and choose Number precision, or paste the smaller example below. Formatting must preserve the integer exactly.

{"event_id":9007199254740993}

Expected formatted output:

{
  "event_id": 9007199254740993
}

The inspector reports a precision notice at $.event_id. It keeps the original number token instead of converting it to a floating-point value. Minifying the document keeps the same token too.

Separate valid syntax from a safe runtime value

JavaScript’s safe integer range ends at 9007199254740991. A number outside that range can be valid JSON without being exactly representable as a JavaScript Number. Long decimal fractions have their own precision limits, even below that magnitude.

This fixed example can run in a JavaScript console. Its expected result demonstrates the boundary; it is not the parser used by Diggwigs.

JSON.parse('{"id":9007199254740993}').id
// Expected: 9007199254740992

The inspector also preserves exponent spelling and long fractions. It does not claim that every downstream system can represent them. Choose a wire contract that matches the receiving system: for identifiers, a documented string representation often avoids arithmetic coercion.

Duplicate keys need a separate decision

Now paste this input:

{"status":"pending","status":"ready"}

Expected result: a duplicate-key error at $.status, with a line and column link. No formatted output is produced. Diggwigs rejects ambiguity instead of selecting a value. Escaped names that decode to the same key are duplicates too.

Syntax validation, duplicate-key policy, and number representation are three different checks. A clean parse alone does not guarantee that a document survived a round trip with its meaning intact.

When debugging an identifier mismatch, compare the original payload before the first numeric conversion.

Diggwigs field notes pair a concrete input with its expected output. Run the examples in the local workspace and inspect the boundary for yourself.