Developer Tools
JSON Formatter
Pretty-print and minify JSON in the browser.
Your information is processed in your browser and is not uploaded to our servers.
JSON
Indentation
Valid JSON.
Your JSON stays in your browser and is not uploaded. For the parse error without formatting, use the JSON Validator.
Formatted output
About this tool
This JSON formatter online pretty-prints or minifies JSON in your browser. Your JSON stays in your browser and is not uploaded. Valid text can be formatted with 2 or 4 spaces, or minified. Invalid text shows the parser message, including a line and column when the error includes a character position.
How to use
- Paste JSON or start from the sample.
- Choose 2 or 4 spaces, then Format. Minify removes the extra whitespace.
- Copy the output, or Clear to start again.
Formula and methodology
JSON.parse, then JSON.stringify with 2 spaces, 4 spaces, or no extra space for minify. This checks JSON syntax only. It does not check an API schema.
Worked example
Formatting { "name": "John", "age": 30 } with 2 spaces puts each property on its own line. Minify returns {"name":"John","age":30}.
How to Format JSON Online
Paste the text, then choose Format. Valid JSON is reprinted with the indentation you selected. Minify is the same parse with the whitespace removed, which keeps the data and drops the line breaks.
JSON Formatter vs JSON Validator
This page formats and minifies, and it reports a parse error when the text is not JSON. The JSON Validator is the page for that error alone, without rewriting the text. Neither page checks that the fields match a schema.
Valid JSON Example
{"name":"John","age":30,"tags":["a","b"]} is valid. {"name":"John",} is not, because of the trailing comma. {name:"John"} is not, because the key is missing double quotes.
Frequently asked questions
Does this send my JSON to a server?+
No. Parsing stays in the tab.
Are comments allowed?+
Standard JSON.parse does not allow comments or trailing commas.
Guides
Related tools
JSON Validator
Validate JSON and show parse errors clearly.
Open tool →
JWT Decoder
Decode a JSON Web Token header and payload in your browser. Signatures are displayed, not verified.
Open tool →
HTML Formatter
Beautify or minify HTML markup locally in the browser.
Open tool →
Base64 Encoder
Encode text to Base64.
Open tool →
Base64 Decoder
Decode Base64 back to text.
Open tool →
UUID Generator
Generate UUID v4 identifiers instantly.
Open tool →