Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Prettify JSON

Format and indent JSON with customizable spacing. Makes minified JSON readable. 100% client-side.

Your files never leave your browser
JSON Input0 chars, 0 lines
Formatted Output0 chars, 0 lines
Error:
    Ready·

    Paste minified or messy JSON, pick your indent style, and get clean formatted output in one click — syntax errors get flagged with the exact character position so you can fix them fast. And everything runs in your browser. Nothing gets uploaded.

    How It Works

    Paste Minified JSON
    ➔
    Parse & Indent
    ➔
    Copy or Download

    The tool parses your input with JSON.parse() to validate the structure, then re-serializes it with JSON.stringify() using your chosen indent level. If the JSON is malformed, you get an error with the exact character position — not just a vague "invalid JSON" message. The entire process stays in JavaScript, in your browser tab.

    Examples

    Formatting an API Response

    You hit a REST endpoint and the response comes back as one line.

    INPUT
    {"users":[{"id":1,"name":"Alice","email":"[email protected]"},{"id":2,"name":"Bob","email":"[email protected]"}],"total":2}
    OUTPUT
    { "users": [ { "id": 1, "name": "Alice", "email": "[email protected]" }, { "id": 2, "name": "Bob", "email": "[email protected]" } ], "total": 2 }

    Debugging a Config File

    Someone committed a package.json with weird formatting. Quick paste to see what changed.

    INPUT
    {"name":"my-app","version":"2.1.0","scripts":{"build":"webpack --mode production","dev":"webpack serve"},"dependencies":{"react":"^18.2.0"}}
    OUTPUT
    { "name": "my-app", "version": "2.1.0", "scripts": { "build": "webpack --mode production", "dev": "webpack serve" }, "dependencies": { "react": "^18.2.0" } }

    Reading Nested GeoJSON Data

    GeoJSON coordinates are nearly impossible to parse visually when minified. Three levels of nested arrays — good luck reading that raw.

    INPUT
    {"type":"Feature","geometry":{"type":"Point","coordinates":[-73.9857,40.7484]},"properties":{"name":"Empire State Building"}}
    OUTPUT
    { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -73.9857, 40.7484 ] }, "properties": { "name": "Empire State Building" } }

    Who Uses This

    👨‍💻 Backend Developers

    Reading API responses and debugging request payloads that come back as single-line blobs.

    🎨 Frontend Developers

    Formatting mock data files and checking component props that are stored as JSON.

    📊 Data Analysts

    Making sense of exported datasets before importing them into notebooks or spreadsheets.

    🛠️ DevOps Engineers

    Reviewing Terraform state files, CI/CD configs, and container manifests in JSON format.

    Common Mistakes

    Trailing commas after the last item

    JavaScript objects allow trailing commas, but JSON does not. If you copy an object straight from your JS code, remove that last comma before the closing brace or bracket.

    Using single quotes instead of double quotes

    JSON requires double quotes around keys and string values. Single quotes will throw a parse error every time. Python's json.dumps() handles this correctly, but hand-editing often introduces them.

    Pasting partial JSON

    Accidentally cutting off the end of a large response when copying from a terminal. The parser needs the complete structure — one missing closing bracket and the whole thing fails.

    Comments in JSON

    Standard JSON doesn't support comments. If you've got // this is a comment lines in there, strip them out first. JSON5 allows comments, but plain JSON does not.

    Technical Details

    Frequently Asked Questions

    What does prettify JSON mean?

    Prettifying JSON means adding whitespace, line breaks, and indentation so the data is easier to read. The actual data stays the same — only the formatting changes. Think of it like reformatting a paragraph with proper line spacing instead of cramming everything onto one line.

    Is prettified JSON larger than minified JSON?

    Yes, file size goes up because you're adding spaces and newlines. For a typical API response, prettified JSON is roughly 30-40% bigger. That's fine for reading and debugging — when you need it small for production, just minify it again.

    Should I use 2 spaces or 4 spaces for JSON indentation?

    Two spaces is the most common convention — it's what npm, VS Code defaults, and most style guides use. Four spaces works if your team prefers it or you're dealing with shallow nesting. Tabs are rare in JSON but some people swear by them. Pick one and stay consistent.

    Can I prettify JSON with comments?

    Standard JSON doesn't allow comments at all. If your file has // or /* */ comments, you're probably looking at JSON5 or JSONC (the format VS Code uses for settings). This tool parses strict JSON, so you'd need to strip comments first.

    Does prettifying JSON change the data?

    No. Not a single value, key, or data type changes. The formatter only adds or removes whitespace characters. If you minify the prettified output, you get back exactly what you started with, byte for byte.

    Share: