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.
How to use the JSON Formatter
- Paste or type your JSON into the left box.
- Choose 2 spaces, 4 spaces, tabs or Minify.
- Turn on Sort keys if you want keys in alphabetical order.
- 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,NaNor 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?
Why does it say my JSON is invalid?
What does minify do?
Can I sort keys alphabetically?
Related tools
- Base64 Encode & DecodeEncode text to Base64 or decode Base64 back to text, with full Unicode support and URL-safe output. Convert files to Base64 data URLs. Free.
- URL Encode & DecodePercent-encode text for URLs and query strings, or decode %20-style URLs back to readable text. Shows query parameters in a table. Free and private.
- Password GeneratorGenerate strong random passwords with your choice of length, letters, numbers and symbols. Shows strength in bits. Made in your browser, never stored.
- UUID GeneratorGenerate random version 4 UUIDs (GUIDs) instantly, one or up to 1,000 at a time, in lowercase or uppercase, with or without hyphens. Free.
- Hash Generator (MD5, SHA-256)Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or files, and verify a download against its checksum. Free, private, no upload.
- Color Converter (HEX, RGB, HSL)Convert colours between HEX, RGB and HSL, pick from a colour picker and check text contrast against white and black. Copy CSS values in one click.