← DevTools/Verify
Docs

The API returned a string where my code expects a number

Shape drift is the failure that survives testing. The request succeeds, the JSON parses, the status is 200, and the only thing wrong is that a field changed type or quietly disappeared.

It is a common way for generated code to be wrong too: an assistant writes a client against a response it inferred, and the real endpoint disagrees in one field.

A worked example

The verdict below is produced by running the verifier on this input — the same code the tool runs in your browser, not a description of it written alongside.

Expected

{
  "users": [
    {
      "id": 1,
      "name": "Alice",
      "active": true
    }
  ],
  "metadata": {
    "total": 2,
    "nextPage": null
  }
}

Actual

{
  "users": [
    {
      "id": "1042",
      "name": "Alice",
      "active": true
    },
    {
      "id": "1043",
      "name": "Bob",
      "active": false
    }
  ],
  "metadata": {
    "total": 2
  }
}
FAIL2 errors.
  • Expected number, received string.

    Evidence
    Expected: number
    Actual: string
    Value: "1042"

    Suggested fix: Return a number at users[0].id.

  • Missing property.

    Evidence
    Expected: null
    Actual: absent

    Suggested fix: Include "nextPage" in the response.

Open this comparison in JSONCraft

What this checks

  • Every key present in one document and missing from the other, named by exact path.
  • Every field whose type changed, including the number-that-became-a-string case above.
  • Where null arrived in place of a value, which is a different problem from a missing key.

What it does not tell you

  • That the values are correct. Comparing shapes says nothing about whether 1042 is the right id.
  • That one sample represents the endpoint. A field that is optional will look like drift when it happens to be absent.

Questions

Does key order matter?

No. Key order is not meaningful in JSON, so it is ignored. Only presence, type and — if you ask for it — value are compared.

How are arrays compared?

By default the first item is treated as the shape for the whole array, which is what you want for a list of uniform records. You can switch to checking every item when the array is heterogeneous.

Can I turn the expected shape into types?

Yes — the same tool exports TypeScript interfaces, Zod schemas and JSON Schema from a document, so the shape you verified can become the shape you enforce.

Why is my JWT rejected?Will my cron job skip or run twice on daylight saving?Paste anything and let it pick the verifier

Everything runs in your browser — nothing you paste is uploaded. Read more about local processing or this verifier in the docs.