Paste valid JSON to see tree
JSON Formatter beautifies, validates and minifies JSON data right in your browser. Paste any JSON string and get clean, indented output — or collapse it to a single line. Errors are highlighted with their exact location.
How to format JSON
- Paste your raw JSON into the input box.
- Click "Format" to beautify and indent the JSON with 2-space indentation.
- Any syntax errors will be highlighted in red with the line number.
- Click "Minify" to collapse the JSON into a single line for API payloads.
- Copy the formatted output or download it as a .json file.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write, and easy for machines to parse and generate. Despite the name, JSON is language-independent and supported in virtually every programming language.
JSON value types
| Type | Example | Notes |
|---|---|---|
| String | "hello" | UTF-8 text, wrapped in double quotes |
| Number | 42 or 3.14 | No leading zeros, no NaN or Infinity |
| Boolean | true / false | Lowercase only |
| Null | null | Represents an intentional absence of value |
| Object | { "key": "value" } | Unordered key/value pairs, keys are strings |
| Array | [ 1, 2, 3 ] | Ordered list of any value types |
Common JSON errors
- Trailing commas after the last array or object entry — JSON does not allow them.
- Using single quotes instead of double quotes for strings and keys.
- Missing quotes around object keys.
- Comments — JSON does not support // or /* */ comments.
- Unescaped special characters in strings (newlines, tabs, quotes).
Frequently asked questions
What is JSON used for?
JSON is the de-facto format for REST API request and response bodies, configuration files (package.json, tsconfig.json), and data storage in NoSQL databases like MongoDB.
How do I validate JSON?
Paste your JSON and click Format. Invalid JSON will show an error message with the exact location (line and column) of the problem.
Can I minify JSON?
Yes, use the "Minify" button to collapse JSON into a single line. This removes whitespace and reduces size — useful for API payloads and storage.
Is there a size limit?
You can format JSON up to 5 MB in size. For larger files, consider streaming JSON parsers.
Is my data sent to your servers?
No. All parsing and formatting runs entirely in your browser using the native JSON.parse and JSON.stringify APIs.