Skip to content
techfen
☰

JSON Formatter & Validator

Paste JSON to pretty-print it, validate it, minify it or sort its keys, with the error location shown if something is wrong.

Share:WhatsAppTelegram

How to use the JSON Formatter

  1. Paste or type your JSON into the left box.
  2. Choose 2 spaces, 4 spaces, tabs or Minify.
  3. Turn on Sort keys if you want keys in alphabetical order.
  4. Copy the result or download it as a .json file.

What the JSON formatter does

JSON (JavaScript Object Notation) is the standard format for APIs, configuration files and data exchange. Machine-generated JSON is often a single long line that is hard to read. This tool parses your JSON and prints it back with consistent indentation, so nested objects and arrays are easy to follow. If the JSON is invalid, it tells you why and, where your browser reports it, the line and column of the problem.

Common JSON errors

  • Trailing commas after the last item in an object or array are not allowed in JSON.
  • Single quotes: strings and keys must use double quotes.
  • Unquoted keys: {name: 1} is JavaScript, not JSON; it must be {"name": 1}.
  • Comments are not part of standard JSON and must be removed.
  • Special values such as undefined, NaN or functions are not valid JSON.

Minify and sort

Minify removes all unnecessary whitespace, which makes payloads smaller for storage or network requests. Sorting keys alphabetically at every level makes two JSON documents easy to compare with a diff tool, because the same data always appears in the same order.

Private by design

Everything happens in your browser. API responses, tokens and customer data you paste are never uploaded. For other encodings, see the Base64 encoder and the URL encoder.

Working with large JSON

The formatter handles files of several megabytes comfortably on a laptop, because parsing uses your browser's built-in JSON engine. For very large logs or exports, minify them before storing to save space, and format only the part you need to read. When comparing two API responses, format both with Sort keys turned on and the same indentation, then compare them line by line; differences in key order will no longer show up as false changes, so only real data differences remain.

Frequently asked questions

Is my JSON uploaded anywhere?
No. Parsing and formatting happen in your browser; nothing is sent to a server.
Why does it say my JSON is invalid?
Common causes are trailing commas, single quotes, unquoted keys or comments. The error message points to the problem.
What does minify do?
It removes spaces and line breaks to make the JSON as small as possible without changing the data.
Can I sort keys alphabetically?
Yes. Turn on Sort keys and every object, including nested ones, is sorted.

Last updated: