Loading JSON Linter...

How to Use the JSON Linter

Valid JSON isn't always safe JSON. A file can pass every syntax check and still lose data on the way into another program, because the standard (RFC 8259) leaves a few things up to the reader. This linter points those spots out.

Step 1

Add your JSON

Paste JSON into the editor, upload a .json or .txt file, or click Sample to try the page with a small example. New to the format? What is JSON covers the basics.

Step 2

Read the verdict

About half a second after you stop typing, the page says whether JSON.parse accepts the text. If it doesn't, you get the first problem in plain English, with its line, column and a caret under the exact spot. The verdict is exactly what the browser's own JSON.parse decides, after removing a byte order mark if the text starts with one.

•
Errors (red): the text isn't JSON yet, for example a trailing comma, single quotes, an unquoted key or a comment
•
Warnings (amber): the text is JSON, but some programs will read a value differently or refuse it
•
Info (blue): harmless things worth knowing, such as trailing spaces
Step 3

Go through the warnings

For JSON that parses, the Warnings list covers things other programs handle differently: repeated keys in one object, integers past 2^53, numbers a double can't hold, -0, lone surrogate escapes, a byte order mark and very deep nesting. Info notes are harmless extras. Each warning names the path, like root.orders[3].id, and the line and column where it starts.

•
8901240544102066246 is flagged because JavaScript reads it as 8901240544102066000
•
{"a": 1, "a": 2} is flagged because most readers silently keep only 2
•
"00501" and 14.50 are left alone: a quoted string keeps its zeros, and 14.50 has the same value as 14.5 (a reader may print it without the zero, but nothing is lost)

Step 4: Copy or download the report

Copy puts the same list you see on screen on your clipboard as plain text; Download saves it as json-lint-report.txt. Once the syntax is fixed you can tidy the layout in the JSON Formatter, try a repair of broken text in the JSON Fixer, or get a quick yes or no from the JSON Validator.

Frequently Asked Questions

What does this linter check that a validator doesn't?

A validator answers one question: does JSON.parse accept the text? This page asks that first and then looks for JSON that is entirely legal but gets read differently by different programs: the same key twice in one object, integers beyond 2^53, numbers too large or too small for a double, -0, half of an emoji escaped on its own (like �), a byte order mark at the start, and nesting deeper than 64 levels. If all you need is a yes or no and some formatting, the JSON Validator is the quicker page.

Why is a repeated key only a warning and not an error?

The JSON standard says names inside an object should be unique, but it doesn't forbid repeats, so {"a": 1, "a": 2} still parses. What happens next depends on the reader: JavaScript and Python quietly keep the last value and drop the first, while some strict parsers refuse the whole document. The linter only flags keys repeated inside the same object. The same key name in two different objects, like "id" in every record of a list, is normal and isn't reported.

My file has an ID like 8901240544102066246. Why is it flagged?

Because most readers won't see those digits. JavaScript, and any language that loads JSON numbers into doubles, holds integers exactly only up to 9,007,199,254,740,991 (2^53 - 1). Above that, JSON.parse turns 8901240544102066246 into 8901240544102066000 without any error. The warning shows the value JavaScript would actually get. If the exact digits matter, as they do for ICCIDs, card numbers or database IDs, send the number as a string.

Does it complain about empty strings, null or empty arrays?

No. "", null, [] and {} are ordinary JSON values, and whether you want them is a question for your own schema, not for a linter. The Info section only holds harmless things worth knowing: lines that end in spaces, a document that is a single plain value instead of an object or array, and decimals with more than 17 significant digits that a double may round.

Can the linter fix the problems for me?

No, it only reports them, each with a line and column and, for syntax errors, the line itself with a caret under the spot. Fixing usually needs a decision only you can make, such as which of two repeated keys is the right one, or whether a long ID should become a string. For broken syntax, the JSON Fixer page can try a repair, and the JSON Formatter tidies the layout once the text parses.

Where does my JSON go when I lint it?

Nowhere. The checks run in your browser, in the JavaScript of this page. Nothing is uploaded and nothing is kept, so a reload starts with an empty editor. The report you copy or download is put together on your own device as well.

How big a file can I lint?

There is no fixed cap, but your browser does all the work, so very large files get slow, mostly in the editor. A few megabytes is fine on a normal laptop. When one check fires many times, the list shows the first 100 and then says how many more there are, so the report stays readable.