JSON Formatter & Validator

Paste JSON to format it with clean indentation, minify it to a single line, sort keys alphabetically or validate it. Errors are reported with the exact line and column so you can fix broken JSON fast.

Result

Your JSON is processed in your browser and never sent to a server – safe for API keys and private data.

Help Us Improve

5.0 out of 5 · 2 ratings

How to use the JSON Formatter & Validator

  1. Paste your JSON into the input box, or type it in.
  2. Click “Format / Beautify” for readable, indented JSON, or “Minify” to remove all whitespace.
  3. If the JSON is invalid, read the error message: it shows the line and column where parsing failed.
  4. Copy the result, download it as a .json file, or send it back to the input for more edits.

What is a JSON formatter?

JSON (JavaScript Object Notation) is the most common format for exchanging data between web services, apps and configuration files. Machines are happy with JSON squeezed onto one line, but people are not: a minified API response with nested objects is almost impossible to read. A JSON formatter (also called a beautifier or pretty-printer) adds line breaks and indentation so the structure becomes clear at a glance. A JSON validator checks that the text follows the JSON rules exactly, so you find mistakes before your code or an API does.

Features

  • Beautify with 2 spaces, 4 spaces or tabs.
  • Minify to the smallest valid form for transport or storage.
  • Sort keys alphabetically at every level, which makes two JSON documents much easier to compare.
  • Validate with precise error locations (line and column) and a highlighted output that colors keys, strings, numbers, booleans and null.
  • Download the result as a .json file.

The most common JSON errors

  • Trailing commas: [1, 2, 3,] is valid JavaScript but invalid JSON.
  • Single quotes: JSON strings and keys must use double quotes: "name", not 'name'.
  • Unquoted keys: {name: "x"} must be {"name": "x"}.
  • Comments: standard JSON does not allow // or /* */ comments.
  • Special values: undefined, NaN and Infinity are not allowed in JSON.
  • Unescaped characters: line breaks and tabs inside strings must be written as \n and \t.

Large numbers and precision

This formatter uses your browser’s built-in JSON parser, which follows the official standard. Like all JavaScript tools, it stores numbers as 64-bit floating point values, so integers larger than 9,007,199,254,740,991 (for example, some database IDs) may lose precision when re-formatted. If your data contains huge IDs, the tool warns you so you can keep them as strings.

Safe for sensitive data

API responses often contain tokens, emails and customer records. Because everything runs locally, nothing you paste here leaves your device.

Examples

Input (minified):

{"user":{"id":42,"name":"Ada","roles":["admin","dev"]},"active":true}

Formatted with 2 spaces:

{
  "user": {
    "id": 42,
    "name": "Ada",
    "roles": [
      "admin",
      "dev"
    ]
  },
  "active": true
}

JSON Formatter & Validator FAQ

How do I validate JSON?

Paste it and click Validate. You will see “Valid JSON” with a summary, or an error that points to the exact line and column where the problem is.

What is the difference between beautify and minify?

Beautify adds indentation and line breaks to make JSON readable. Minify removes all unnecessary whitespace to make it as small as possible for sending or storing.

Why does my JSON with comments fail?

Comments are not part of the JSON standard. Remove them, or keep that file in a format that allows comments, such as JSONC or YAML.

Is my data uploaded?

No. Formatting and validation run entirely in your browser, so private data and API keys stay on your device.

Related tools

All Developer Tools
Base64 Encode / DecodeEncode or decode Base64 for text and files, UTF-8 safe.Compare Two ListsFind differences, common items, and unique entries between two text lists.Cron Expression GeneratorBuild cron schedules with simple menus, or paste any cron expression to explain it in plain English and see the next 5 run times.Diff CheckerCompare two texts and see every added, removed and changed line, with word or character highlights, side by side or unified.HEX to RGB ConverterConvert HEX color codes to RGB, RGBA and HSL and back, with a live swatch, color picker, alpha control and copy-ready CSS.JSON to CSVConvert a JSON array to CSV with nested objects flattened into dot-named columns, comma, semicolon or tab delimiters and a live preview.JSON to ExcelConvert a JSON array to a real Excel .xlsx spreadsheet or CSV, with nested objects flattened into dot-named columns and a live preview.PX to REM ConverterConvert pixels (px) to rem and rem to px with custom root font size and CSS table.Regex TesterTest JavaScript regular expressions live: highlighted matches, capture and named groups, indices, flags and a replace preview.Unix Timestamp ConverterSee the current Unix epoch time live, convert timestamps in seconds, milliseconds or microseconds to dates, and dates back to timestamps.URL Decode & EncodeDecode or encode URLs and query strings (percent-encoding), with + as space option and a query parameter table.Flip ImageMirror a photo horizontally or flip it upside down, then download it as JPG, PNG or WebP.Upside Down TextFlip text upside down (ʇxǝʇ uʍop ǝpᴉsdn), flip letters without reversing, or write backwards, then copy and paste it anywhere. Decodes it back too.