JSON Formatter
Pretty-print and validate JSON
Loadingโฆ
About this tool
This tool actually parses your pasted text with JSON.parse to validate its syntax, then reformats it with indentation or collapses it to one line. For example, the default sample that is prefilled when you open the tool, `{"name":"nol.so","tools":67,"tags":["utility","calculator"],"open":true,"owner":{"since":2026}}`, becomes five clearly separated lines - name, tools, tags, open, and owner - once you format it with 2-space indentation, making the nested structure easy to read at a glance. When the syntax is broken, it points to the exact line and column where the problem starts, so you do not have to hunt for a missing brace or comma by eye. Keep in mind it only supports standard JSON syntax - JSON5 extensions like comments, trailing commas, or single-quoted strings are all flagged as errors - and everything runs in your browser, so nothing you paste is ever sent to a server.
How to use
- Click a sample button (Default / Nested array / One-liner), or paste your own JSON text into the input box.
- Parsing happens as you type, so you can immediately see whether the text is valid.
- If there is a syntax error, a red box tells you exactly which line and column it happened on.
- Use the indent buttons (2 spaces / 4 spaces / one line) to change the output format.
- Review the formatted result, then use the copy button to grab it.
- Keep editing the input and it re-validates automatically - no button press needed.
Frequently asked questions
- How are the line and column numbers in error messages calculated?
- JSON.parse reports a character position; this tool re-derives the line and column from that position using the line breaks in your input.
- Does this support JSON5 or JSON with comments?
- No. Only standard JSON syntax is supported. Comments, trailing commas, and single-quoted strings are all flagged as errors.
- What changes when I collapse to one line?
- Picking 'one line' in the indent options outputs the JSON with no whitespace or line breaks at minimum size, useful when you need a compact body for an API request.
- Is the JSON I enter stored on a server?
- No. Parsing and formatting all happen in your browser and are never sent to a server.
- What sample examples are available?
- Three ready-made samples - a default example, one with a nested array, and one packed onto a single line - can each be loaded with one click.
- What happens if I leave the input box empty?
- An empty input is not treated as an error - it just waits quietly with no result shown. Parsing begins as soon as you start typing text.
- Does it validate arrays, strings, or numbers, not just objects?
- JSON.parse accepts any valid JSON value - objects, arrays, strings, numbers, true/false, and null - and this tool validates and formats whatever you give it.
- Can I edit individual values with this tool?
- No. This tool only validates and reformats the text you provide - there is no way to click a key and edit its value. To change a value, edit the text in the input box directly.