An API response squeezed onto one line or a webhook payload copied from a log: raw JSON is hard to read and easy to break. This JSON formatter and validator parses your input first, and only if it is valid does it rebuild the text with clean indentation or compress it into a compact one-liner. If the JSON is broken, you get the parser's error message instead of a half-formatted result.
Everything happens locally in your browser tab. The JSON you paste, including any access tokens, API keys or personal data it contains, is never uploaded to a server. You can format up to 1 MiB of input, nest data up to 128 levels deep, and produce up to 10 MiB of output, which comfortably covers typical API responses, fixtures and configuration files.
How to use: JSON Formatter and Validator
- Paste your JSON into the JSON data field, or press Load sample to try the tool with an example.
- Choose 2-space indent, 4-space indent or Minify from the Output format menu.
- Press Convert. Valid JSON appears in the Result panel in the format you picked.
- If you see an Invalid JSON error, use the position or line and column in the message to find the problem, fix it and convert again.
- Press Copy to put the result on your clipboard or Download to save it as a .json file, then use Clear to start over.
Example: {"id":7,"tags":["a","b"]} becomes a neatly indented block with each key on its own line.
Common JSON errors and what they mean
When parsing fails, the tool shows "Invalid JSON:" followed by your browser's own error text. Chrome and Edge typically report a character position such as "at position 42", sometimes with a line and column, while Firefox reports the line and column directly. The wording differs, but the cause is almost always one of the following.
- Unexpected token < in JSON at position 0: you pasted HTML, usually an error page or login redirect returned instead of the API response you expected.
- Trailing comma: a comma after the last item, as in [1, 2, ], is allowed in JavaScript but not in JSON.
- Single quotes or unquoted keys: JSON requires double quotes around every key and string, so {name: 'Ann'} is invalid.
- Comments: neither // nor /* */ comments are part of JSON, even though some config formats accept them.
- Smart quotes and non-JSON values: curly quotes from a chat app, undefined, NaN and Infinity are all rejected.
What the validator checks and what it does not
The tool validates syntax: matching brackets and braces, correct quoting, commas in the right places and legal values. It does not validate your data against a JSON Schema, check required fields or confirm that types match what your API expects. A document can be perfectly valid JSON and still be the wrong shape for your application.
Formatting preserves your data exactly. Keys stay in their original order, string contents are untouched, and numbers keep the digits you wrote, so long IDs are not rounded in the output. Keep in mind that JavaScript code reading the same JSON may still round integers beyond 9,007,199,254,740,991; sending such IDs as strings is the safer convention.
Pretty print or minify?
Pretty printed JSON is for humans: code reviews, bug reports and debugging. Two-space indentation is the usual JavaScript style, while four spaces can be easier to scan in deeply nested data. Minified JSON drops every unnecessary space and line break, which suits environment variables, single-line logs and request bodies. Before pasting either version into a ticket or public issue, replace tokens and keys with placeholders.
Frequently asked questions
What does a JSON formatter do?
A JSON formatter takes compact or messy JSON and rewrites it with consistent indentation and line breaks so the structure is easy to read. This tool also validates the input first, so it doubles as a JSON validator. You can choose 2-space or 4-space indentation, or go the other way and minify the JSON into a single compact line.
How do I fix "Unexpected token" in JSON?
The error means the parser met a character it did not expect at that point. Look at the position or line and column in the message, then check just before it for a missing comma, a trailing comma, single quotes or an unquoted key. If the unexpected token is "<" at position 0, the input is HTML rather than JSON, usually an error page from the server.
Is it safe to paste JSON with API keys or tokens?
The tool runs entirely in your browser, so the JSON is not uploaded, logged or stored by Falanca. That makes it safer than converters that process data on a server. Still, treat secrets carefully: avoid pasting them on shared screens, remove them before sharing formatted output, and revoke any key that may already have leaked.
Can it validate JSON against a schema?
No. This is a syntax validator: it confirms that your text is well-formed JSON and shows where it breaks if not. It does not support JSON Schema, so it cannot check required properties, value types or allowed enums. For schema validation, use a dedicated library such as Ajv in your project or CI pipeline.
How large can my JSON be?
You can paste up to 1 MiB of JSON with up to 128 levels of nesting. The formatted output can be up to 10 MiB. Pretty printing adds spaces and line breaks, so a very large, deeply nested file may exceed the output limit; in that case choose Minify or split the data into smaller parts.