JSON Formatter and Validator

Validate, format or minify JSON, and explore objects with collapse and depth controls.

Inputs stay on your device No sign-up Free to use
How this works

The tool runs in this browser. Your file or text is not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Privacy details

Format controls

Showing an example. Edit to see your own.

Paste JSON text. It is parsed in your browser and never uploaded.

Action

Used when formatting.

Processed in your browser. Your inputs stay on this device.

How to use JSON Formatter and Validator

  1. Paste your JSON into the JSON box.
  2. Choose Format and indent, Minify or Validate only in Action.
  3. Pick an Indentation if you are formatting.
  4. The formatted, minified or validated result updates as you change the JSON. Copy it or read the error line and column.

Example: JSON Formatter and Validator

Format a small object with three keys.

You add
{"name":"Ada","items":[1,2,3],"active":true}
You get
The same document indented with two spaces, reported as 44 characters in and 75 characters out, with the root value an object with 3 keys. The counts table shows 1 object, 1 array, 3 numbers and a deepest nesting of 3.

Options

Action
Format and indent rewrites the document with line breaks, Minify removes every optional space, and Validate only reports whether the JSON is valid without producing any output.
Sort object keys alphabetically
Reorders the keys of every object, at any depth, before formatting or minifying. Array order is never changed. Useful when you want two JSON files to diff cleanly.
Collapsible tree
Open individual objects and arrays, choose an expansion depth or collapse the visible tree. The preview is bounded to 1,000 nodes and 40 levels and shortens long values. Copy and download contain the complete formatted or minified JSON.

Supported inputs and limits

Standard JSON only: keys need double quotes, comments are not allowed, and there is no trailing comma. The tool reads one JSON document, so a JSON Lines or NDJSON file with one object per line will fail. Input is capped at 10,000,000 characters. Numbers follow JavaScript precision, so an integer longer than 15 digits can change when the document is re-serialized; the tool warns you when it spots one. Repeated keys in the same object keep the last value, which is standard JavaScript behavior. Validate only does not report duplicate keys. Tree bounds affect only the preview. Validate only still reports validity without exporting a rewritten document.

Where your input is processed

This tool processes your input in this browser. Your text and files are not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Why long numbers change when JSON is formatted

JSON itself puts no limit on how long a number can be. The limit comes from the tools that read it. This tool parses JSON with JavaScript, which stores numbers as 64-bit floating point values and holds about 15 or 16 significant digits exactly. A bank account number or a long order ID is often longer, so parsing it into a number silently rounds the tail. The safe rule: if a value is an identifier rather than something you do arithmetic on, send it as a string. Formatted JSON keeps strings untouched, so no digits are lost.

Questions about JSON Formatter and Validator

Why did a long ID in my JSON change?

JavaScript can round a 17-digit numeric ID when it parses the document. Store exact IDs as strings before formatting.

Can I format JSON that contains comments or trailing commas?

No. Both are outside the JSON specification, so the parser rejects them. Remove the comments, or convert the file to a format that allows them, before pasting it here.

What does Validate only tell me when the JSON is good?

It reports the root value, such as an object with 4 keys or an array with 12 items, and a table counting objects, arrays, strings, numbers, booleans, null values, keys and the deepest nesting. It does not print the document back.

Does formatting change my data?

String values and keys keep their text, but the spelling of an escaped character can change, so an accented letter written as an escape may come back as the letter itself. Numbers are written in their shortest form, so 1.50 becomes 1.5 and 1e2 may become 100. Key order stays as you wrote it unless you turn on sorting.

How precise is the error position?

The tool reports a line and a column, and falls back to its own scanner when the browser's error message omits a position. Treat the position as a starting point, since the real problem is sometimes one line earlier, such as a missing comma.

Project manager: Tony Hines · Content updated 30 September 2026 · Report a problem