Developer and Text Tools

How to Format and Validate JSON Online (and Find the Mistake)

Make messy JSON readable, shrink it to one line and see exactly what is wrong when it will not parse. Free and private.

Saizul Amin
Saizul Amin১০ অক্টো, ২০২৬ · 6 মিনিটের পড়া
How to Format and Validate JSON Online (and Find the Mistake)

JSON is the language that applications use to talk to each other: API responses, configuration files, exported data. It is easy for machines and hard for humans when it arrives as one long unbroken line. And when one comma is missing, a whole file stops working with an unhelpful error.

The free JSON Formatter turns a messy block into readable, indented text, and tells you where a mistake is.

The JSON Formatter on shobfree.com

Quick answer

Paste your JSON, press Format to indent it neatly or Minify to shrink it to one line. If the JSON is wrong, the message shows what went wrong. Everything runs in your browser and is not uploaded.

What the tool does

  • Format: adds two-space indentation and line breaks so the structure is easy to read.
  • Minify: removes all unneeded spaces and line breaks, which makes the data smaller to send.
  • Validate: checks that the text is valid JSON and reports the error if it is not.

How to use it, step by step

  1. Open the JSON Formatter.
  2. Paste your JSON into the top box.
  3. Press Format to make it readable, or Minify to compress it.
  4. Read the result in the lower box and copy it.
  5. If there is an error, fix the place named in the message and try again.

The most common JSON mistakes

MistakeExampleFix
Trailing comma{"a": 1,}Remove the last comma
Single quotes{'a': 1}Use double quotes
Unquoted keys{a: 1}Write "a" with quotes
Missing comma{"a": 1 "b": 2}Add a comma between items
Comments// noteJSON does not allow comments
Missing bracket{"a": [1, 2}Close every bracket and brace

JSON rules to remember

  • Text values and keys use double quotes.
  • Values can be a string, number, object, array, true, false or null.
  • Items in objects and arrays are separated by commas, with no comma after the last item.
  • There is no undefined, no comments and no single quotes.

Is it safe to paste private data?

The text is processed in your browser and is not uploaded, so it is suitable for private configuration and data. Even so, avoid pasting live secrets such as passwords or API keys into any online tool when you do not need to.

Reading JSON like a developer

Once formatted, JSON has a simple structure:

  • Objects are wrapped in curly braces and contain key-value pairs.
  • Arrays are wrapped in square brackets and hold ordered lists of values.
  • Values can themselves be objects or arrays, so data can be nested to any depth.

A formatted API response might look like a user with a name, an email and a list of orders. Indentation shows which items belong to which parent, which is why formatting makes errors visible.

Debugging an invalid JSON error

When parsing fails, work through these steps:

  1. Look at the line and column that the message mentions.
  2. Check the characters just before it, since the problem is often a missing comma or quote earlier.
  3. Check the end of the file, where a missing closing bracket is reported.
  4. Look for smart quotes pasted from Word or chat apps. They look like quotes but are different characters.
  5. Remove comments and trailing commas, which strict JSON does not allow.
  6. Check for unescaped characters inside strings, such as a double quote or a backslash.

JSON in everyday work

  • APIs: requests and responses are almost always JSON.
  • Config files: package.json, tsconfig.json and many app settings.
  • Data exports: analytics, e-commerce and CMS exports.
  • NoSQL databases: documents stored as JSON.
  • Spreadsheets to apps: convert a table with CSV to JSON.

Good practice

  • Validate before you deploy a configuration change.
  • Keep keys consistent in naming style, such as camelCase.
  • Do not store secrets in files that are committed to public repositories.
  • Prefer small, focused objects over giant nested ones.
  • Compare versions of a file with the Text Diff Checker.

Quick checklist

  1. Paste the full text.
  2. Format and read the error message if any.
  3. Fix quotes, commas and brackets.
  4. Minify when you need a compact version.

A worked example: fixing a configuration file

A developer edits a settings file and the application fails to start with "unexpected token". She pastes the file into the formatter. The message points to a position near the end of the third object. Looking there, she sees that a comma was left after the last item in an array, which JSON does not allow. She removes it, formats again and the output is clean. She copies the formatted version back, compares it with the old version using a diff checker to ensure that nothing else changed, and restarts the application.

Fixing the error took less than two minutes instead of the half hour of reading the file by eye.

Tips for working with large JSON

  • Format first so that the structure is visible.
  • Collapse and read one section at a time in your editor.
  • Look for repeating patterns such as arrays of similar objects.
  • Validate after every manual edit.
  • Keep a backup of the working version.

Frequently asked questions

What does Format do? It indents your JSON with two spaces so that its structure is clear.

What does Minify do? It shrinks the JSON to a single line without extra spaces.

How do I find the error in my JSON? Press Format. If the JSON is invalid, the message tells you what went wrong.

Is my data uploaded? No. It is processed in your browser.

Is it free? Yes.

What is the difference between JSON and a JavaScript object? JSON is a text format with stricter rules: double quotes for keys and strings, and no functions or comments.

Why does my JSON fail with an "unexpected token" message? There is usually a stray character, a missing comma or a mismatched bracket near the position given.

Is two-space indentation required? No. It is a style choice that makes the data easier to read.

Can I edit data in the formatted view? Copy the formatted result into your editor to make changes, then validate again.

Why does Format reject my data from JavaScript? A JavaScript object literal is not always valid JSON, for example with single quotes or unquoted keys.

Next step

Open the JSON Formatter below, paste your data and see it clearly.

সম্পূর্ণ ফ্রিকোনো খরচ বা সাইন-আপ নেই
ফাইল নিরাপদকাজ শেষে স্বয়ংক্রিয় মুছে ফেলা
বাংলায় সহজবাংলা ও ইংরেজি দুই ভাষায়