PixConvert

Free Online JSON Formatter & Validator

Clean, validate, and beautify messy JSON data. Spot syntax syntax errors instantly and toggle between 2-space, 4-space, or minified output.

Paste JSON above to begin

How to Format JSON in 3 Steps

1

Paste your JSON.

Paste or type it into the editor, or click Load Example to try a sample. The status bar shows Valid JSON or the first error.

2

Fix any errors.

The message names the first problem, such as a trailing comma or a single-quoted key; hover it if it is cut off. Format and Minify turn on once the JSON is valid.

3

Format, then copy or share.

Click Format for 2-space indents or Minify for one line. Copy puts the result on your clipboard, and Share Link copies a link to it.

Frequently Asked Questions

Answers about formatting, validating, share links and what Format changes in your JSON.

How do I format JSON online?

Paste your JSON into the editor and click Format. The tool parses it and rewrites it with 2 spaces per level and one value per line, in the same editor. Click Copy to take the result, or Minify to turn it back into one line.

What is the difference between Format and Minify?

Format adds line breaks and 2-space indents so people can read the JSON. Minify removes every space and line break outside strings, which gives the smallest text for an API call or a config value. Both are built from the same parsed data.

Why does my JSON show as invalid?

The usual causes are a trailing comma, single quotes, keys without quotes, comments, or values like NaN and undefined. JSON allows none of these. The status bar shows the browser's message for the first problem and cuts long ones short; hover to read it all. Chrome and Edge include the line and column.

How do I validate JSON?

Paste it into the editor. The JSON validator checks the text again after each change and shows a green Valid JSON label or a red error message. It checks syntax only; it does not test your data against a JSON Schema.

Can I change the indentation or sort the keys?

No. Format always uses 2 spaces, and there is no tab, 4-space or sort option. Keys stay in their original order, except keys that are whole numbers, such as "2" or "10", which JavaScript moves to the top of their object.

Does formatting change my data?

Usually only the spacing changes. Because Format rebuilds the JSON from parsed data, whole numbers over 9,007,199,254,740,991 lose their last digits, 1.0 becomes 1, \u escapes become plain characters and a repeated key keeps its last value. Store long IDs as strings to keep them exact.

Does it accept JSON5, comments or JSON Lines?

No. It accepts strict JSON only, so comments, trailing commas and unquoted keys are errors. A JSON Lines file fails at line 2 because it holds several values. Format one line at a time, or wrap the lines in [ ] with commas between them.

How do share links work?

The editor stores your JSON in the page address after #data=, encoded as Base64, and updates it about half a second after you stop typing. Share Link copies that address. The part after # is not sent to our server when the link opens, but anyone holding the link can read the JSON.

How much JSON can I format at once?

The tool sets no limit. In a Node test of the same code, 6 MB of JSON was checked in 44 ms and formatted in 42 ms. Drawing very long text in the editor takes longer, and share links grow to about 3.5 times the JSON, so large files make huge links.

Is it safe to paste API keys or tokens?

Your JSON is checked and formatted on your device and is not sent to us. The editor does copy it into the page address, which your browser keeps in its history, so click Clear when you finish with secrets. Analytics record clicks like Format and Copy, the time taken and a size range, never the JSON.

JSON Formatter Features: Format, Validate, Minify

Check JSON as you type, re-indent or compress it in one click, and share a link that opens the same JSON in the editor.

JSON formatter turning a 52 B one-line object into 9 lines with 2-space indents, with format and minify buttons

Format or Minify JSON in One Click

Format re-indents your JSON with 2 spaces per level and one value per line. Minify strips every space and line break between values. Both replace the text in the editor.

  • Pretty-print with 2-space indents
  • Minify to a single line
  • Result replaces the editor text
Try now
JSON validator with a green check for valid JSON and a red mark on a trailing comma, with the format button turned off

Validate JSON While You Type

The validator rechecks after every change. The status bar shows Valid JSON or the browser's error, which includes the first mistake's position. Long messages are cut off; hover to read all.

  • Rechecks after every edit
  • Hover the error for its position
  • Format stays off until JSON is valid
Try now

Share a Link to Your JSON

Share Link copies the page address, which holds your JSON after #data= in Base64. Anyone who opens it sees the same JSON. A reload keeps your text too.

A Code Editor With Line Numbers

You edit in Monaco, the editor behind VS Code, with JSON highlighting, line numbers and bracket matching. The status bar shows the line count and size as you go.

What Formatting Can Change

Formatting rewrites the parsed data. Whole numbers over 9,007,199,254,740,991 lose digits, 1.0 becomes 1, and a repeated key keeps only its last value. Keep long IDs as strings.

Free to Use, No Sign-Up

There is no account, usage cap or size limit. Your JSON is checked and formatted on your device; analytics record clicks like Format and Copy, the time taken and a size range.

Who Uses This JSON Formatter

Developers and testers who read API responses, fix config files or tidy data before sharing it.

API Development

Paste a raw API response to read it as indented JSON, or check a request body before you send it. A share link passes the same payload to a teammate.

  • Turn a one-line API response into readable JSON
  • Catch a missing comma before you send a request
  • Send a payload to a teammate as a link

Config Files

Clean up package.json, composer.json or other JSON config files. The validator points to the first syntax error, and Format gives the whole file the same 2-space style.

  • Find trailing commas and missing quotes by position
  • Give every file the same 2-space indentation
  • Minify a settings file to a single line

Data and Logs

Check that a JSON export or a single log entry parses before you load it elsewhere. Formatting a minified record makes nested fields easy to read.

  • Confirm an export parses as one JSON value
  • Expand a minified log record for reading
  • Shrink a record with Minify before storing it