Home › Developer Tools › JSON Formatter

JSON Formatter

Paste JSON to beautify, minify or validate it. Errors are pinned to the exact line and column, and you can explore the data in a collapsible tree.

Last updated:

Input
Waiting for JSON…

      
      
Advertisement
Advertisement

How to use the JSON Formatter

  1. Paste your JSON into the left box, or upload a .json file.
  2. Check the status bar. Valid JSON shows a green tick. If there's a mistake, the line is highlighted and the message tells you what's wrong. Click Go to error to jump to it.
  3. Choose Beautify or Minify and the indentation you like. The result appears on the right.
  4. Switch to Tree view to fold and unfold objects and arrays. Click any key to see its path, such as $.users[0].email.
  5. Copy or download the formatted JSON.

Common JSON errors and how to fix them

ErrorWrongRight
Trailing comma{"a": 1, "b": 2,}{"a": 1, "b": 2}
Single quotes{'name': 'Ann'}{"name": "Ann"}
Unquoted key{name: "Ann"}{"name": "Ann"}
Missing comma["a" "b"]["a", "b"]
Comments{"a": 1 // note}{"a": 1, "note": "…"}
Python / JS valuesTrue, None, undefinedtrue, null
Line break in a string"line one
line two"
"line one\nline two"

Beautify vs. minify

Beautify (also called pretty print) puts each property on its own line and indents nested objects, which makes API responses and config files easy to read and compare. Minify removes all optional spaces and line breaks. Minified JSON is smaller, which is what you want for production config, requests and storage. Both keep your data exactly the same.

Frequently asked questions

What does a JSON formatter do?

It adds line breaks and indentation to JSON so it is easy to read (beautify), or removes all unnecessary whitespace to make it as small as possible (minify). It also checks that the JSON is valid.

Why is my JSON invalid?

The most common causes are a trailing comma after the last item, single quotes instead of double quotes, property names without quotes, comments, and missing commas between items. The validator shows the line, column and reason for the first error.

Is my JSON sent to a server?

No. Formatting and validation happen entirely in your browser, so private data such as API responses and config files never leave your device.

Will large numbers lose precision?

No. Beautify and Minify keep every number exactly as you wrote it, even very long IDs. Only the Sort keys option and the tree view read numbers as JavaScript numbers, which round beyond about 15 to 17 digits.

How big a file can I format?

Files of several megabytes work fine in a modern browser. Syntax colors are switched off for very large outputs to keep the page fast.

What is the difference between JSON and a JavaScript object?

JSON is stricter: keys must be in double quotes, strings must use double quotes, and trailing commas, comments, undefined and functions are not allowed.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.XML to JSONConvert XML to JSON with validation.Base64 Encoder DecoderEncode or decode Base64 text and files, and make data URIs.AI Token CounterCount GPT tokens in any text, see every token highlighted and estimate the API input cost.App Icon GeneratorMake every iOS, Android adaptive, PWA and macOS app icon size from one image, as a ZIP.App Store Screenshot GeneratorTurn app screenshots into framed store images with captions, in App Store and Google Play sizes, as a ZIP.Browser Storage TestSee your browser's storage quota and usage, and test localStorage, IndexedDB and cookie limits.ZIP File CreatorCompress files and folders into a ZIP.HTML MinifierMinify HTML: strip comments and whitespace safely and see how many bytes you save.CSS MinifierMinify CSS with csso or a built-in engine and see the size saved instantly.IPv6 Expander & CompressorExpand IPv6 addresses to full form or compress them per RFC 5952, one or many at once.CSS ValidatorValidate CSS: syntax errors, unknown properties and invalid values by line, plus auto-fix.IBAN ValidatorCheck an IBAN's mod-97 checksum, country and length, and see its bank code and account parts.JavaScript Syntax CheckerCheck JavaScript for syntax errors with line and column, for any ES version, script or module.JSON Schema ValidatorValidate JSON against a JSON Schema (draft-07, 2019-09, 2020-12) with clickable error paths.Markdown FormatterBeautify Markdown with Prettier: list markers, prose wrap, aligned tables and live preview.PHP FormatterBeautify PHP code with Prettier PHP: PSR-12 style, indent and brace options, syntax errors.TypeScript FormatterFormat TypeScript and TSX code with Prettier: width, tabs, semicolons and quotes options.XML MinifierMinify and validate XML: strip whitespace and comments, keep CDATA, see the size savings.C# FormatterBeautify C# code online: Allman or K&R braces, indent size and line width, clang-format option.HTML ValidatorCheck HTML for errors and warnings with line numbers, locally or with the W3C Nu checker.Java FormatterBeautify Java code online: indent size, brace style and line width, with clang-format option.JavaScript ObfuscatorObfuscate JavaScript with string encoding, renaming and control-flow flattening presets.Phone Number FormatterFormat and validate lists of phone numbers to E.164, international or national style.Responsive Design CheckerPreview any website at phone, tablet, laptop and desktop sizes side by side, with rotate and zoom.Browser Compatibility CheckerSearch CSS, JavaScript and HTML features and see which browser versions support them.Core Web Vitals CheckerCheck real-user LCP, INP and CLS for any URL or site and see if it passes Core Web Vitals.Heading Structure CheckerPaste HTML to see its H1-H6 outline and catch missing H1s, multiple H1s and skipped levels.Website Hosting CheckerFind out who hosts a website: hosting provider, IP addresses, ASN, network owner and location.Routing Number ValidatorCheck a US ABA routing number's checksum and format and see its Federal Reserve district.Spam Word CheckerScan an email subject and body for spam trigger words, excess caps, exclamation marks and risky links.Check Digit CalculatorCalculate or validate check digits for UPC, EAN, GTIN, SSCC, ISBN, ISSN and mod 11 codes.Luhn Algorithm CheckerValidate numbers with the Luhn mod 10 check or calculate the missing check digit, step by step.XSD ValidatorValidate XML against an XSD schema in your browser and see each error with its line number.Strftime Format BuilderBuild Python and C strftime format strings by clicking tokens, with a live preview and reference.
See all 41 Code Formatters & Validators →