What is JSON Linting?
JSON linting is the process of checking JSON data against the strict RFC 8259 specification to find syntax errors before they cause runtime crashes in your application. Unlike formatting, linting focuses entirely on correctness — not readability.
JSON Lint vs JSON Validate: What's the Difference?
In practice, the terms are used interchangeably for JSON. Both mean "check this JSON for syntax correctness." The word "lint" comes from the C programming language's original linter tool from the 1970s, which checked code for suspicious patterns.
Common Issues JSON Lint Catches
- Single-quoted strings:
'hello'(must be"hello") - Unquoted keys:
{name: "Alice"}(must be{"name": "Alice"}) - Trailing commas:
[1, 2, 3,] - JavaScript comments:
// commentor/* block */ - Leading zeros in numbers:
007(invalid in JSON) - NaN or Infinity values: not valid JSON primitives
- Unclosed brackets or braces
Why Use a Dedicated JSON Linter?
Many text editors and IDEs show JSON errors, but they often miss edge cases and rarely show the exact RFC 8259 rule being violated. A dedicated JSON linter provides more precise error messages with byte positions.