The same input through four tools#
The input is {"id":9007199254740993,"p":1.10,"a":2,"a":3}.
| Tool | id | p | a |
|---|---|---|---|
jq -c ., version 1.7 | 9007199254740993 | 1.10 | 3 |
jq -c '.id+0', version 1.7 | 9007199254740992 | ||
Node 24, JSON.parse then JSON.stringify | 9007199254740992 | 1.1 | 3 |
Python 3.12, json.loads then json.dumps | 9007199254740993 | 1.1 | 3 |
The ID is one above 2 to the power of 53, the first integer a double cannot hold. Node loses it. jq 1.7 keeps the literal text as long as no arithmetic touches it, and loses it when one does. Other jq versions can differ, so check jq --version with the sender.
All of them keep the last a. RFC 8259 says that when names within an object are not unique, "the behavior of software that receives such an object is unpredictable". RFC 8259 If the bug is that two services disagree about a duplicate key, the pretty-printed payload shows no duplicate at all.
Capture before parsing#
curl -sS -o body.bin -D headers.txt -w '%{http_code}\n' https://api.example.com/orders/7
sha256sum body.bin
-o writes the body as received, after any decompression that you asked for. Read it with xxd body.bin | head when an invisible character is possible.
To replay the request, send the file and not the text:
curl -sS -H 'content-type: application/json' --data-binary @request.bin URL
--data @file strips carriage returns and newlines, which changes a signed body. --data-binary does not.
Find whether a tool already changed it#
| Sign | What it suggests |
|---|---|
| A 16-digit or longer ID ending in an even digit or 0 | A pass through doubles |
| Money without its trailing zero | Parsed and written again |
| Keys in alphabetical order | A formatter with sorting on |
| Curly quotes, or a non-breaking space | A chat or document editor |
| No trailing newline where the server sends one | A copy from a browser panel |
Each sign has innocent explanations: half of all large IDs are even. The comparison that decides is the hash against a capture at the source.
Decide what to hand over#
If the question is about a value, a formatted excerpt with the field is enough, with the raw file beside it. If it is about a signature, a duplicate key, number handling or encoding, only the raw bytes will do. If the payload holds personal data, build a synthetic one that still fails, and keep the shape that matters: the same number of digits, the same duplicate.
Worked example#
This example is fictional. A partner reports that order 9007199254740992 does not exist. Support confirms that it does not. The partner's ticket was pasted from a log viewer that parses JSON in JavaScript. The raw file in their queue has …993, and that order exists. The actual bug is in the partner's consumer, which fetches by the parsed number. Sending IDs as strings would remove the failure on both sides, and that is an API decision to make separately.
In application code, the same loss is described in 64-bit IDs in JavaScript. Return to handing over evidence.