JSON Formatter

dev tool

JSON Formatter
Left
Right

Paste valid JSON to see tree

Ln 1 · Col 1

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

  1. Paste your raw JSON into the input box.
  2. Click "Format" to beautify and indent the JSON with 2-space indentation.
  3. Any syntax errors will be highlighted in red with the line number.
  4. Click "Minify" to collapse the JSON into a single line for API payloads.
  5. 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

TypeExampleNotes
String"hello"UTF-8 text, wrapped in double quotes
Number42 or 3.14No leading zeros, no NaN or Infinity
Booleantrue / falseLowercase only
NullnullRepresents 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).
Privacy
All formatting happens in your browser. Your JSON is never sent to our servers.

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.