JSON Formatter
Format, minify, and validate JSON data.
This tool formats, validates, and minifies JSON entirely in your browser. Paste a messy API response, a config file, or a one-line string, and it parses the data, then re-indents it with clean 2-space spacing so nested objects and arrays are easy to read.
When the input is invalid, you get the exact JavaScript parser error such as a misplaced comma or unquoted key, instead of failing silently. It also reports the root type, total key count, and maximum nesting depth, which is handy for inspecting unfamiliar payloads before you write code against them.
How to use
- Paste or type your JSON into the Input box.
- Click Format to pretty-print it with 2-space indentation, or Minify to strip all whitespace into a single line.
- Click Validate to confirm the JSON is well-formed without changing its layout.
- If parsing fails, read the red error message to locate the syntax problem, fix it, and try again.
- Use the Copy button to copy the formatted or minified result to your clipboard.
FAQ
- Is my JSON uploaded to a server?
- No. All parsing, formatting, and minifying happen locally in your browser using the native JSON engine. Nothing is sent over the network, so it is safe for sensitive data.
- What indentation does Format use?
- Format uses two spaces per nesting level, matching the common default for most editors and linters. Minify removes all whitespace to produce the smallest possible single-line output.
- What do the Type, Keys, and Depth stats mean?
- Type is the root value (object, array, string, number, and so on). Keys is the total number of object keys counted across all nesting levels. Depth is the deepest level of nesting in the structure.
- Why does it reject JSON that looks valid?
- Strict JSON does not allow trailing commas, single quotes, comments, or unquoted keys. The error message shows where parsing stopped, so check for those issues near the reported position.