E031Error

NaN or Infinity is not valid JSON

A NaN or Infinity value was used.

What it means

JSON has no representation for NaN, Infinity, or -Infinity. They are valid in JSON5 only. Serializers usually emit these by accident when a computation overflows or divides by zero.

Example

Invalid
{ "amount": Infinity }
Valid
{ "amount": null }

How to fix it

Replace it with null or a string, or fix the value before serializing.

Validate your JSON to see this and every other issue highlighted in one pass.


Diagnostics on this page come from @jsonlint/core, the open-source engine that powers the JSONLint validator. Install it with npm install @jsonlint/core.