Formatting JSON safely
Pretty JSON is easier to debug — but validation comes first.
Validate before you format
JSON has strict rules: double quotes for strings, no trailing commas, and only one top-level value. A formatter can’t guess what you meant if the input isn’t valid JSON, so it helps to get a clear error first and fix that line.
Common errors
- Trailing commas after the last item in an object/array.
- Single quotes instead of double quotes.
- Unescaped characters inside strings (like raw newlines).
Don’t paste secrets
Logs and config files often include API keys, tokens, cookies, and passwords. Before you share JSON with anyone, remove or mask sensitive fields. If you’re working with auth headers, treat them like passwords.
Try it
Tool: JSON Formatter