JSON Formatter & Validator

Pretty-print, minify and validate JSON, find errors by line and column, and browse it as a tree

Result

Format and check JSON without leaving your browser

Paste a JSON document to make it readable with your preferred indentation, shrink it into a single line for APIs and config files, or just check that it is valid. When something is wrong the tool points to the exact line and column, shows the line with a marker and can jump to it in the editor. The tree view lets you collapse and expand objects and arrays in large payloads. Your data is processed locally and never uploaded.

How to format and validate JSON online

  1. 1

    Paste or upload your JSON

    Paste the text in the left box, click the upload icon to open a .json file, or click the wand icon to load a sample.

  2. 2

    Choose indentation and key order

    Pick 2 spaces, 4 spaces or a tab, and tick "Sort keys A-Z" if you want the keys of every object in alphabetical order.

  3. 3

    Format, minify or validate

    Click Format to beautify, Minify for a compact single line, or Validate to just check the syntax. Errors show the line and column with a marker.

  4. 4

    Copy or download

    Copy the result, download it as data.json, or switch to the Tree view to expand and collapse objects and arrays.

Format, minify and validate

Formatting turns a dense JSON text into a readable one with the indentation you choose. Minifying does the opposite: it removes every unnecessary space and line break, which is useful for API requests, config files and smaller payloads.

Validation follows the JSON standard strictly. When the text is invalid, the tool tells you the line and column of the first problem, shows that line with a marker and can jump to it in the editor.

Common JSON mistakes the tool explains

Most invalid JSON comes from habits borrowed from JavaScript. The error message adds a hint when it recognizes one of these cases:

  • Comments (// or /* */): JSON does not allow them
  • A trailing comma before } or ]
  • Single quotes instead of double quotes
  • Unquoted keys or values such as {name: 1}
  • NaN, Infinity and undefined, which are not JSON values

Tree view and sorted keys

The tree view lets you collapse and expand objects and arrays, which makes large responses much easier to explore. Sorting keys gives a stable order, handy to compare two JSON documents or to keep a config file tidy.

Large numbers lose precision

Browsers read JSON numbers as 64-bit floating point values, so integers above 9007199254740991 (such as some database IDs) can change when the JSON is parsed and written back. The tool warns you when it finds one. If exact digits matter, store those values as strings.

Private by design

Your JSON is processed in your browser and never uploaded, so it is safe to use with tokens, configuration and customer data.

JSON formatter FAQ

How do I format JSON online?

Paste your JSON in the left box, choose the indentation and click Format. The result appears on the right, ready to copy or download.

How do I find the error in my JSON?

The tool shows the line and column of the first syntax error, displays that line with a marker and has a button to jump to the position in the editor.

Why does it say my JSON is invalid when it works in JavaScript?

JavaScript objects accept comments, single quotes, unquoted keys and trailing commas. Strict JSON does not. The error hint tells you which one to fix.

What does Minify do?

It removes all spaces and line breaks that are not part of a string, producing the smallest valid JSON on a single line.

Does sorting keys change my data?

Only the order of the keys inside objects changes. Values and the order of array items are kept.

Is my JSON uploaded anywhere?

No. Everything runs in your browser, including the file upload option, so nothing is sent to a server.

Is it free?

Yes. It is free, needs no sign-up and has no limit on the number of documents.