Developer ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Developer Tools

JSON Formatter and Validator

Format, minify, validate and sort JSON in your browser. Errors show the line, column and cause, and lenient parsing fixes comments and trailing commas.

View all tools
ResultUpdates as you type

Object with 6 top-level keys, nested 2 levels deep; 143 → 214 bytes (+49.7%).

{
  "name": "Online Tools",
  "version": 2,
  "active": true,
  "tags": [
    "json",
    "format"
  ],
  "owner": {
    "name": "Alice",
    "email": "alice@example.com"
  },
  "items": [
    3,
    1,
    2
  ]
}

How to use JSON Formatter and Validator

Paste JSON on the left and choose Format, Minify or Validate; the result updates as you type. Tick Sort keys for a stable key order, or Lenient parsing to turn a JavaScript object with comments or single quotes into standard JSON.

  1. Paste your JSONPaste an API response, a config file or a log entry. Objects, arrays and single values all work.
  2. Pick an actionFormat with 2 spaces, 4 spaces or tabs, minify to one line, or validate to see the type, depth and size.
  3. Copy the resultCopy result copies only the processed JSON. If there is an error, go to the line and column shown.

Error messages that point at the problem

When the JSON does not parse, the tool reports the line and column and says what is wrong, such as a trailing comma after the last item, a key without double quotes or a comment, and marks the spot with a caret under the offending line. The checks are the tool's own, so the message is the same in Chrome, Safari and Firefox. If the only problems are comments, trailing commas, single quotes, bare keys or Python's True, False and None, tick Lenient parsing and the tool fixes them and lists what it changed.

Sorting, duplicate keys and large numbers

Sort keys orders the keys of every object, at every level, while arrays keep their order, so {"b":2,"a":1} minifies to {"a":1,"b":2}. When an object repeats a key, standard parsing keeps only the last value; the tool warns you and gives the line of the first duplicate. Integers longer than 15 digits and long decimals are written out exactly in browsers that support JSON.rawJSON, and older browsers show a warning instead. The default sample is 143 bytes on one line and 214 bytes once formatted.

Accuracy and data handling

Validate the result with your project's own tests and runtime rules before using it in production. The calculation runs in your current browser; the tool code does not send the input to a processing API.

Often Used Together

Next step

FAQ

Why is my JSON invalid?

The usual causes are a trailing comma, single-quoted strings, keys without double quotes, comments and missing brackets. The tool gives the line, column and reason, and Lenient parsing fixes comments, trailing commas and quotes automatically.

Does formatting change my data?

Only whitespace and indentation change, plus the key order if you sort keys; arrays are never reordered. Repeated keys keep their last value, and newer browsers keep very long integers exactly as written.

Can I minify JSON for a config file or request body?

Yes. Choose Minify to one line to remove every space and line break outside strings, and tick Sort keys as well if you want a stable order for comparing or caching.

Is my JSON uploaded?

No. Parsing, validation, formatting and sorting run in your browser. The input only goes into a URL if you press Share link and copy it.

More Developer Tools

Related tools