๐Ÿ“˜ JSON Formatter

Pretty-print or minify JSON, and validate its syntax.

How to use

  1. Paste your JSON text into the input box on the left.
  2. Click "Pretty" or "Minify" to convert it.
  3. Any syntax errors are shown immediately with their location.

๐ŸŽฏ Use Cases

Example

Input
{"name":"developk","tags":["json","tool"],"active":true}
Output
{
  "name": "developk",
  "tags": [
    "json",
    "tool"
  ],
  "active": true
}

This is the result of applying "Pretty" to JSON squashed onto a single line. A 2-space indent is added so keys, values, and array items each sit on their own line.

Common JSON syntax errors

InvalidWhy it failsValid
{'name':'a'}Single quotes aren't valid JSON syntax{"name":"a"}
{"a":1,}Trailing comma after the last item{"a":1}
{a:1}Key written without quotes{"a":1}
{"a":undefined}undefined isn't a valid JSON value{"a":null}
{"a":01}Leading zero before a number{"a":1}

JSON looks similar to a JavaScript object literal but is a stricter subset. Pasting code straight from JavaScript often triggers a syntax error for one of the reasons above.

FAQ

Is the JSON I enter sent to a server?
No. It's processed entirely in your browser using JSON.parse/JSON.stringify.
Why do I see a "syntax error" message?
If the text doesn't follow standard JSON syntax (single quotes aren't allowed, trailing commas aren't allowed, etc.), you'll be shown the error location. See the comparison table above for common patterns.
What's the difference between Pretty and Minify?
Pretty adds indentation to make the JSON easy for humans to read, while Minify removes unnecessary whitespace and line breaks to reduce file size. Most API responses sent over the wire are minified.
Does this handle JSON with comments?
No. Standard JSON doesn't support comments. Remove any // or /* */ comments before pasting your text in.

๐Ÿ“˜ Learn more: Using a JSON Formatter to Read API Responses

Turn minified JSON into something readable

More Coding Tools

๐Ÿ—“๏ธ
Timestamp Converter
Convert Unix timestamp โ†” date
๐Ÿงฉ
JSON String Encoder
Convert text โ†” JSON string literal
โœจ
JS/CSS Formatter
Indent & tidy JS/CSS code
โœ‚๏ธ
JS/CSS Minifier
Strip comments & whitespace
๐Ÿงฝ
HTML Formatter
Indent HTML by tag structure
๐Ÿงน
XML Formatter
Indent XML by tag structure
๐Ÿ—ƒ๏ธ
SQL Formatter
Break SQL into clauses & indent
๐Ÿ”ฃ
HTML Entity Encoder
Convert special chars โ†” HTML entities
๐Ÿ“Š
Excel to HTML Table
Convert spreadsheet data to HTML TABLE
โ›“๏ธ
Link Extractor
Extract href/src links from HTML
๐ŸŽจ
Color Picker
Get HEX, RGB & HSL color codes
๐Ÿ˜
PHP Syntax Checker
Check bracket/string pairing (practical checker)
๐Ÿ—„๏ธ
MySQL Syntax Checker
Check bracket/quote pairing (practical checker)
๐Ÿ”
HTML5 Validator
Check tag pairing, duplicate id, missing alt
โœ๏ธ
Online HTML Editor
Write & edit HTML visually