Free Online JSON Formatter & Validator

Format, minify, and validate JSON.

JSONFormatting

Format, minify, or validate JSON

Diagnose a JSON parse error

Start with Format when an API response arrives as one long line. Indentation makes it easier to see which object owns a property, where a nested array ends, and whether a missing field is actually present with a null value. This is useful when comparing a sample payload with the response described in API documentation. It also helps when reviewing configuration copied from an environment variable, where a compact value is common.

If validation fails, begin at the reported position, then inspect the preceding line. A parser can notice a missing comma only when it encounters the next property, so the highlighted location can be just after the real mistake. Double-check straight double quotes, matching braces and brackets, and commas between items. For instance, {"active": true,} is invalid because the closing brace follows a trailing comma. Removing that comma makes it valid JSON.

Validate checks JSON syntax. It cannot tell whether an API requires a particular field name or data type. For example, {"age": "32"} is valid JSON even if an endpoint requires an integer. Once syntax passes, compare the formatted value with your API contract. Keep a copy of the original if exact property order, duplicate keys, or large number literals matter. A parse-and-format operation can change the textual representation. Use the dedicated JSON Minifier when you need to remove structural whitespace while preserving the original number tokens.

If the first formatting pass produces a quoted string containing backslashes, the payload may have been stringified twice. Decode the outer string with the JSON String Escaper first, then feed the resulting text back into the formatter. This is common when JSON travels inside a log message or another JSON field.

Find the missing comma in an API payload

Validate first. The parser may flag the opening quote of items. Insert a comma after 42, then choose Format to see the repaired structure.

{"orderId":42 "items":[{"sku":"A-1","qty":2}]}

Expected output

{
  "orderId": 42,
  "items": [
    {
      "sku": "A-1",
      "qty": 2
    }
  ]
}

How to use it

  1. Paste a JSON object, array, or primitive.
  2. Choose Format, Minify, or Validate.
  3. Read the result or the parse error line and column.

Common questions

Why does a JavaScript object fail JSON validation?
JSON requires double-quoted property names and strings. Comments and trailing commas are not allowed.
When should I minify JSON?
Minify when you need compact output for a request body or configuration field. Format when a person needs to inspect it.

The tool processes your input in this browser. It does not upload the input itself.