RRaahUPSCTOOLS & UTILITIES

JSON Formatter, Validator and Beautifier

Beautify, minify and validate JSON with the exact line and column of any error. Free, private, no sign-up.

Sample JSON

Common errors caught

  • • Trailing commas
  • • Single quotes instead of double
  • • Missing quotes on keys
  • • Missing commas and unclosed brackets
  • • Comments, NaN and undefined

How to use the JSON formatter

  1. Paste your JSON into the Input JSON box, or click Load sample.
  2. Choose the indentation you want: 2 spaces, 4 spaces or tabs.
  3. Click Format to beautify, Minify to compress, or Validate to only check it.
  4. If there is an error, read the line and column in the message; the problem spot is highlighted in the input.
  5. Click Copy Output to copy the result.

How validation works

JSON (JavaScript Object Notation) is a text format for data. Valid JSON is one value: an object in {}, an array in [], a string in double quotes, a number, true, false or null. The validator reads your text character by character and stops at the first place that breaks these rules.

InvalidWhy it failsFix
{"a": 1,}Trailing comma{"a": 1}
{'a': 1}Single quotes{"a": 1}
{a: 1}Unquoted property name{"a": 1}
[1 2]Missing comma[1, 2]
{"n": NaN}NaN is not JSON{"n": null}
{"n": 07}Leading zero{"n": 7}

Example

The input below has a trailing comma on line 3:

{
  "exam": "UPSC Prelims",
  "papers": 2,
}

The validator reports Trailing comma before }: remove the last comma (line 4, column 1), pointing at the closing brace right after the extra comma. Delete the comma after 2 and the JSON is valid.

Key facts

  • JSON strings and property names must use double quotes.
  • JSON does not allow comments or trailing commas.
  • Formatting changes only whitespace; data, key order and number text stay the same.
  • Everything runs locally in your browser.

Tips

Frequently asked questions

How do I format JSON online?

Paste your JSON into the input box and click Format. The tool checks that it is valid and rewrites it with consistent indentation (2 spaces, 4 spaces or tabs), one key per line, ready to read or copy.

How does the formatter show where my JSON error is?

It reports the line and column of the first error, explains the likely cause, and highlights that spot in the input box. Lines and columns are counted from 1, so line 3, column 1 is the first character of the third line.

What are the most common JSON errors?

The most common errors are a trailing comma after the last item, single quotes instead of double quotes, property names without quotes, a missing comma between items, comments, and values like undefined or NaN. JSON allows none of these.

Will formatting change my numbers or key order?

No. The formatter keeps every number exactly as written, including very large IDs that JavaScript would normally round, and keeps keys in their original order. Only whitespace changes.

What does Minify do?

Minify removes all spaces, tabs and line breaks that are not inside strings, producing the most compact valid JSON. It is useful for sending data over a network or storing it in a single line.

Is my JSON data uploaded anywhere?

No. All processing happens in your browser. Your JSON never leaves your device, so it is safe to use with private data.

More Text & Utility Tools

Free, private and no sign-up. Everything runs in your browser.