Skip to content
BassoHub
Tools

JSON formatter

Format, validate and minify JSON online for free. Shows the exact error line and column, sorts keys and has a tree view. Runs in your browser: nothing is uploaded.

JSON formatter and validator

Paste JSON to validate and format it. Checking is automatic.

Result

Output
Indentation
View

Formatted JSON shows up here.

Everything runs in your browser: the JSON is never sent to a server, isn't stored, and the tool works offline once loaded.

How to use

  1. Paste your JSON into the input box, drop a .json file on it or tap Open. There's no "validate" button: checking happens as you type.
  2. If everything is fine, you'll see Valid JSON with a summary (how many objects, arrays, keys and nesting levels) and the formatted result next to it.
  3. Pick the output: Format (2 spaces, 4 spaces or tabs) or Minify (a single line with no whitespace, ideal for a request body or a smaller config file).
  4. Check Sort keys to put the keys of every object in alphabetical order. It's a big help when comparing two API responses.
  5. Switch to Tree to browse the document by expanding and collapsing each object. Tap a key to see its path (for example $.users[0].email) and copy it.
  6. Copy, download the file or use Use as input to keep editing from the result.

When the JSON has an error

The tool shows the exact line and column of the problem, a snippet of that line with the offending character highlighted and a plain-language explanation of what's wrong. The Go to error button puts the cursor right on it. The input's line numbers also mark the error line.

What JSON is

JSON (JavaScript Object Notation) is the most common text format for exchanging data between systems: API responses, config files, database exports, logs. It has only six kinds of value: object ({ "key": value }), array ([1, 2, 3]), string in double quotes, number, true/false and null. The rules are simple but strict: one character out of place makes the whole file invalid.

The most common mistakes

  • Trailing comma after the last item: [1, 2, 3,]. JavaScript accepts it; JSON doesn't.
  • Missing comma between two items, usually at the end of a line.
  • Single quotes ('name') or unquoted keys ({name: "Ann"}): in JSON, keys are always double-quoted strings.
  • Curly quotes (“ ”) that sneak in when text goes through a word processor, email or chat apps.
  • Comments (// or /* */): standard JSON doesn't allow them. Files like tsconfig.json do because they use a variant (JSONC).
  • JavaScript values that don't exist in JSON: undefined, NaN, Infinity, capitalized True.
  • Invisible spaces copied from PDFs or web pages (such as the non-breaking space). The tool detects them and tells you which one it found.
  • Two documents pasted back to back ({...}{...}). For several records, use an array.

Formatting without changing your data

Many formatters run JSON.parse and then JSON.stringify, which silently changes the content: big numbers get rounded (an ID like 12345678901234567890 becomes 12345678901234567000), 1.0 becomes 1, numeric keys move around and duplicate keys disappear. Here the text is read by a dedicated parser that keeps numbers and strings exactly as written and preserves the original key order. When it finds a duplicate key or a number that would lose precision in JavaScript, it shows a warning even though the JSON is valid.

Limitations

  • The input must follow strict JSON (RFC 8259). Variants such as JSON5, JSONC (with comments) and JSON Lines (one object per line) are reported as errors.
  • Very large files (tens of MB) work, but editing gets slower depending on your device. With large texts, validation waits until you pause typing, so the page doesn't freeze.

Privacy

Everything is processed in your browser. The JSON is never sent to a server and isn't stored anywhere. Once the page has loaded, the tool works even offline. Still, avoid pasting passwords, tokens and personal data into online tools you don't trust.