JSON Validator

Developer Tools

Check JSON and find the exact error line

FreePrivateInstant
Add a file · .txt .md .csv .json … · up to 2.00 MB
Embed this tool on your websiteFree
  1. Choose how tall the frame should be.
  2. Press Copy code.
  3. Paste it into your page, blog, WordPress or Notion HTML block.
Height

The tool runs inside your visitor's browser, nothing is uploaded, and a small "Powered by ToolCloak" line stays under it. The second line (script) is optional: it makes the frame fit the tool's height.

Similar tools you may like

History

All history →
About this tool

Checking JSON: what “valid” really means and how to fix the errors people hit most

A JSON validator answers one question: will a strict parser accept this text? That sounds easy until you paste something copied from code, a log or a chat message and it fails on a line that looks perfectly fine. This page explains what the tool tells you, how to read the error, and the dozen mistakes that cause almost every failure.

What you get back

If the text is valid, the tool does not just say “OK”. It also reads the structure and shows three facts:

  • Root type: object, array, string, number, boolean or null. APIs usually expect an object or an array at the top, so a surprise here often explains a bug.
  • Keys / items: the total count of keys and array items, including every nested level. For {"name":"Asha","skills":["react","node"]} that is 4: two keys at the top, plus two items inside the array.
  • Depth: how deeply things are nested. A flat object is depth 1. An object holding an object is depth 2. A very deep structure (say 10+) is a hint that the data is hard to work with, or that something was wrapped by mistake.

If it is invalid

You see “Invalid JSON”, the reason given by your browser’s own JSON parser, and, where the browser reports a position, the line and column. Browsers word their messages differently, so Chrome, Firefox and Safari may describe the same error in different words. The cause is the same.

One idea saves a lot of time: the parser reports where it gave up, not where you made the mistake. If you forget a comma at the end of line 12, the parser only notices at the start of line 13, so look at the line before the one reported, and the one before that.

The mistakes behind nearly every error

What you wroteProblemFix
{'name': 'Asha'}Single quotes are not allowedUse double quotes: {"name": "Asha"}
{name: "Asha"}Keys must be in double quotes{"name": "Asha"}
[1, 2, 3,]Comma after the last itemRemove the final comma
{"a": 1 "b": 2}Missing comma between pairsAdd a comma after 1
// note or /* note */JSON has no commentsDelete them, or store the note in a field
{"a": undefined}undefined is a JavaScript idea, not JSONUse null or leave the key out
{"id": 007}Leading zeros are not allowed in numbersWrite 7, or "007" as text
{"ok": True}Booleans must be lowercasetrue / false
{"x": NaN}NaN and Infinity do not exist in JSONnull or a string
Text with a real line break inside quotesNewlines inside a string must be escapedUse \n inside the string

Invisible problems

Some failures cannot be seen at all. If the data looks right and still fails, check these:

  • Curly quotes. Text that passed through a chat app or a word processor often has “smart quotes” instead of straight ones. They look the same, but the parser does not accept them.
  • A byte-order mark (an invisible character at the very start of a file saved by some Windows programs). Delete the first character and try again.
  • Two JSON values pasted together, such as {"a":1}{"b":2}. A file with one JSON object per line (often called JSON Lines) is not valid as a single document. Validate one line at a time.
  • Trailing text, like a stray ; or a log timestamp after the closing bracket.
  • Unescaped backslashes in Windows paths. "C:\Users" must be written "C:\\Users".

Valid does not mean correct

This tool checks the grammar, not the meaning. It cannot know that your API expects age to be a number while you sent "29" as text, or that a required field is missing. Those need a schema check, which is a separate step.

Two other things pass silently and surprise people. First, duplicate keys: {"a":1,"a":2} is accepted, and most parsers quietly keep the last value. Second, very large numbers: JavaScript cannot store whole numbers above 9,007,199,254,740,991 exactly, so an ID like 12345678901234567890 can change after parsing. If you handle long IDs, send them as strings.

Validate, format and minify are different jobs

A good habit: validate first. Formatting broken JSON only gives you neatly indented broken JSON.

  • Validate (this tool): is it legal JSON, and what is its shape?
  • Format / beautify: add indentation so people can read it. Use the JSON Formatter once the text is valid.
  • Minify: remove spaces to make it smaller for sending over a network.

A quick way to fix a long, broken file

  1. Paste it and read the first error. Ignore the ones you imagine will come after, because one early mistake can hide everything below it.
  2. Look at the reported line and the line above it. Check commas, quotes and brackets.
  3. Fix only that one thing, then validate again. Repeat.
  4. If the file is huge, cut it in half. If the first half is valid up to the cut, the error is in the second half. This binary search finds a single bad character in a few tries.
  5. Once it passes, check the root type and the item count against what you expected.

Privacy

Parsing happens in your browser with the built-in JSON parser. Your data is not uploaded, so it is fine to check API responses, configuration files and test data that you would not want to paste into a random website.

JSON Validator — at a glance

Validate any JSON and see the exact line and column of the first error.

Your input
{"a":1,
Run
Result
✕ Invalid JSON
line 1, column 7

How to use it — step by step

Any JSON text — an object, an array or a single value.

1

Paste your input

Paste or type your content into the big input box. Try a sample if you want to see it work.

2

Choose options

Pick the mode and options that fit what you need.

3

Validate JSON

Press the button. The result is created instantly on your device.

4

Copy the result

Check the output and press Copy to use it anywhere.

Pro tips

Small things that make the result better.

✦Most JSON errors are a missing comma, a trailing comma or single quotes instead of double quotes.
✦Property names must be wrapped in double quotes.
✦After it is valid, use the JSON Formatter to make it pretty.

Quick facts

Freeno signup, no limit
Instantresult in a moment
Privatenothing is uploaded
Any devicephone, tablet or PC

Frequently Asked Questions

What is JSON Validator?+

Validate any JSON and see the exact line and column of the first error. When the JSON is valid you also get the root type, total keys and nesting depth.

How do I use JSON Validator?+

Open JSON Validator on this page, then: 1. Paste your input 2. Choose options 3. Validate JSON 4. Copy the result. Everything runs in your browser on a phone or computer.

What does the line and column mean?+

It points to where the parser first got confused. The real mistake is usually just before that spot.

Are comments allowed in JSON?+

No. Standard JSON does not allow comments or trailing commas.

Is my data safe?+

Yes. Everything runs inside your own browser. Your text, files and images are never uploaded to any server.

Is this tool really free?+

Yes — completely free, no signup, no watermark and no usage limit.

Also searched as: json validator · validate json online · json checker · json lint · json syntax checker · find json error

More Free Tools