About the JSON Formatter
The JSON Formatter pretty-prints JSON with your preferred indentation, highlights the syntax, and validates the document as you type. When the JSON is invalid you get a human-readable message with the exact line and column of the problem — click it to jump straight to the error.
Unlike many online formatters, numbers larger than JavaScript’s safe integer range (such as 64-bit IDs) keep their full precision, and you can switch to a collapsible tree view to explore large documents.
Features
- Strict RFC 8259 validation with line & column errors
- Beautify with 2, 3, 4 spaces or tabs
- Minify / compact JSON to a single line
- Repair JSON with comments, trailing commas, single quotes or unquoted keys
- Recursive key sorting for stable diffs
- Collapsible tree view for large documents
- Keeps precision of very large integers
- Drag & drop or upload
.jsonfiles
How to use it
- Paste JSON into the Input pane, drop a file onto it, or click Upload.
- The output updates automatically. Choose the indentation or click Minify for compact output.
- If the JSON is invalid, read the error below the editor and click Go to error.
- Use Repair to fix JavaScript-style objects, then copy or download the result.
Frequently asked questions
Is my JSON sent to a server?
No. Parsing and formatting happen in JavaScript inside your browser. You can even disconnect from the internet after the page loads and the tool keeps working.
What does “Repair JSON” fix?
It accepts relaxed syntax commonly found in JavaScript and config files — // and /* */ comments, trailing commas, single-quoted strings, unquoted keys, missing commas and undefined — and converts it to strict, valid JSON.
Why do other tools change my large numbers?
JavaScript stores numbers as 64-bit floats, so integers above 9,007,199,254,740,991 lose precision with JSON.parse. This formatter uses its own parser and keeps the original digits in modern browsers.
What is the difference between formatting and validating?
Validation checks whether text is syntactically valid JSON. Formatting re-prints valid JSON with consistent indentation and line breaks. This tool does both at once.
How large a file can I format?
Files of tens of megabytes work; syntax highlighting is disabled automatically above ~600 KB of output to keep the page responsive.