Invalid numbers in JSON

JSON's number grammar is narrower than JavaScript's. Leading zeros, a leading plus, hex literals and a bare decimal point are all rejected.

Open the JSON formatter

What the error looks like

Different engines word this differently. You may see any of these:

Why it happens

Example

Invalid
{
  "id": 007,
  "delta": +1,
  "mask": 0x1F,
  "ratio": .5
}
Valid
{
  "id": 7,
  "delta": 1,
  "mask": 31,
  "ratio": 0.5
}

How this tool reports it

The formatter reports each one with the correction it would make, and converts hexadecimal literals to their decimal value rather than dropping them.

Paste your JSON into the formatter to see the exact line and column, or use the validator if you only need to check it.

Worth knowing