Format and Validate JSON
Turn a one-line API response into readable, indented JSON, or squeeze a config file down to one line. If the JSON is broken, you get the line and column where parsing failed.
- Free
- Runs in your browser
- Error line and column
- No sign-up
How It Works
Clean up JSON in three steps.
Paste your JSON
From an API response, a log line, a .json file or a database field.
Format or minify
Pick the indent and optionally sort keys, then press Format, or press Minify for one line.
Copy or download
Copy the result or save it as a .json file.
What does a JSON formatter do?
JSON from an API usually arrives on a single line with no spaces, which is fine for machines and unreadable for people. A formatter parses it and writes it back out with one key per line and nested objects indented, so you can see the structure. Because it has to parse the JSON first, it also works as a validator: if parsing fails, the text is not valid JSON and the error tells you where.
This is strict JSON. Comments, trailing commas and single-quoted strings are not allowed by the JSON standard, so they are reported as errors. Those come from JSON5 or JavaScript object syntax.
Error position
Shows the line and column of the first syntax error, such as a missing comma or an unquoted key.
Sort keys
Orders the keys of every object alphabetically, which makes two JSON files much easier to compare.
Minify
Removes all whitespace for the smallest payload, for example before storing JSON in a database column.
Your indent
2 spaces, 4 spaces or tabs, to match your project's style.
Convert PDF Files and File Formats
Find the perfect online tool to combine PDF files, compress documents, and handle your daily workflow effortlessly.
PDF Tools
All your PDF needs in one place
- Merge PDF
- Organize PDF
- Split PDF
- Compress PDF
- Convert to Word
- Convert to Image
Image Tools
Edit and optimize your images
- Resize Image
- Compress Image
- Convert Format
- Crop Image
- Add Watermark
- Remove Background
Word Tools
Work with Word documents
- Convert to PDF
- Merge Documents
- Split Documents
- Compress File
- Edit Text
- Add Watermark
Excel Tools
Process Excel spreadsheets
- Convert to PDF
- Convert to CSV
- Merge Sheets
- Split Sheets
- Compress File
- Clean Data
Why Use This JSON Formatter
Readable JSON and clear errors.
Private
API responses often contain tokens or personal data. Here they are parsed in your browser and never uploaded.
Finds the error
A line and column number beat scanning thousands of characters for a missing bracket.
Sorted keys
Recursive key sorting for stable output you can diff.
Save as a file
Download the formatted result as formatted.json.
Frequently Asked Questions
Questions people ask about the JSON Formatter.
JavaScript objects allow things JSON does not: comments, trailing commas, single quotes and unquoted keys. Remove them, or put keys and strings in double quotes.
Numbers larger than 9,007,199,254,740,991 (2^53 - 1) lose precision when parsed in a browser, so a long ID like 12345678901234567890 can come out slightly different. If your JSON has IDs like that, store them as strings.
No. Keys inside objects are sorted, at every level, but the order of items in an array stays the same because it is part of the data.
Files of a few megabytes format quickly. Very large files of 50 MB and more depend on your device's memory and may make the tab slow.
Related Text & Developer Tools
More small utilities that run in your browser.
JSON to YAML
Convert JSON to clean, readable YAML.
YAML to JSON
Convert YAML to JSON, with errors shown by line.
SQL Formatter
Format and beautify SQL queries for 14 dialects.
JSON to XML
Convert JSON to well-formed XML.
JSON Flatten & Unflatten
Flatten nested JSON to dot keys or rebuild it.