Tool / Text & Dev

JSON Formatter

Use Kitly JSON Formatter to clean up API responses, config files, logs, and structured data locally in your browser. A successful format means the text is valid JSON syntax, not that a schema passed.

Output
Formatted JSON will appear here.

How to format and validate JSON

Use formatting to inspect structure and minification only after the data parses successfully.

  1. Paste the JSON

    Insert the object, array, API response, or configuration data. Avoid pasting secrets you do not need to inspect.

  2. Format or minify

    Format for indentation and syntax highlighting, or minify when you need compact valid JSON.

  3. Resolve errors and export

    If parsing fails, use the reported position as a starting point. After validation succeeds, copy or download the result.

Common JSON problems to check

  • JSON requires double quotes around property names and string values; single quotes are not valid JSON.
  • Trailing commas after the final property or array item cause strict JSON parsing to fail.
  • Comments, undefined, NaN, and JavaScript functions are not part of the JSON data format.

Validation scope

  • Successful parsing confirms JSON syntax, not whether the data follows an API contract or JSON Schema.
  • The tool does not automatically repair invalid input because silent fixes could change meaning.
  • Very large payloads can use substantial browser memory and may be better handled with command-line or streaming tools.

Practical guidance

These examples show a nested document after formatting and minifying, a syntax error with the observed parser detail, and integers at the edge of JavaScript’s safe range. A last example is valid JSON that still would fail a schema.

Formatting needs JavaScript because the browser parses and reprints the text locally. The measured examples, choices, and troubleshooting below remain readable when JavaScript is unavailable.

Measured JSON fixtures

Results were produced with the page’s formatter on Node.js 22.19.0: JSON.parse, then the integer check, then JSON.stringify. The samples are original and contain no secrets.

Nested JSON, formatted and minified

A compact nested object grows when formatted with two spaces and returns to the same compact text when minified.

Input, 111 B

{"kit":"sample","ready":true,"count":2,"note":null,"tags":["pdf","json"],"nested":{"locale":"en","weight":1.5}}
Settings
Format JSON.stringify with 2 spaces
Minify JSON.stringify with no extra space

Observed results

Format, 164 B
{
  "kit": "sample",
  "ready": true,
  "count": 2,
  "note": null,
  "tags": [
    "pdf",
    "json"
  ],
  "nested": {
    "locale": "en",
    "weight": 1.5
  }
}

Minify, 111 B
{"kit":"sample","ready":true,"count":2,"note":null,"tags":["pdf","json"],"nested":{"locale":"en","weight":1.5}}

What to check

Formatting changed 111 B to 164 B. Minifying that formatted text returned 111 B, identical to the input. Keys, true, null, and 1.5 stayed the same. The status “Valid JSON” here means the text parsed. A schema check is a separate step.

Caveats

  • Minify matched the input because the input was already compact. It does not shrink every document.
  • The formatted and minified files are the exact strings, with no extra trailing newline.

Example files

Integers outside the safe range are refused

An unquoted integer above 9007199254740991 is rejected so the formatter does not write a different number.

Refused input, 47 B

{"reference":9007199254740993,"label":"unsafe"}
Settings
Safe inclusive bound ±9007199254740991
Refused token 9007199254740993

Tool result

This JSON contains an integer outside JavaScript's safe range. To avoid changing its digits, store that value as a quoted string before formatting.

What to check

The formatted output was left empty. JSON.parse alone turned 9007199254740993 into 9007199254740992. The formatter then finds that original token and does not write the changed number. The same refusal happened for 9007199254740992 and for -9007199254740993. The integer 9007199254740991 formatted unchanged, to a 35 B document.

Caveats

  • Quoting the digits works. quoted-large-integer.json formats to a 58 B document and keeps 9007199254740993 as a string.
  • A decimal token skips the integer check. decimal-large-number.json uses 9007199254740993.0 and the formatter writes 9007199254740992. Quote the value, or keep it an integer inside the safe bound, when every digit matters.

Example files

A trailing comma is invalid JSON

The formatter reports the parser detail and does not guess a repair.

Input, 24 B

{
  "label": "sample",
}

Tool result

This is not valid JSON. Expected double-quoted property name in JSON at position 23 (line 3 column 1)

What to check

The output was left empty. The sentence after the period is the V8 parser detail observed on Node.js 22.19.0. Another browser engine can word that detail differently. Position 23 is the closing brace on line 3, after the trailing comma.

Caveats

  • The tool does not remove the comma for you. A silent repair could change a different document.

Example files

Valid syntax can still be the wrong shape

An object whose pages value is the string “two” formats successfully.

Input, 29 B

{"status":"ok","pages":"two"}

Formatted JSON, 38 B

{
  "status": "ok",
  "pages": "two"
}

What to check

The formatter accepted this text. A schema that required pages to be a number would reject the string “two”. This page checks JSON syntax only. Field names, types, and API contracts need a separate schema check.

Caveats

  • The tool status “Valid JSON” describes the parse. It is not approval of the data’s shape.

Example files

Format, minify, quote, or validate a schema

Formatting and minifying both require the text to parse. Neither one checks a schema.

Format

Use when: You need to read nested structure, as in the 111 B sample.

Trade-offs: The sample grew from 111 B to 164 B. The values were unchanged.

Minify

Use when: You need compact JSON after the text has parsed.

Trade-offs: The already compact sample stayed at 111 B. Minify removes extra space; it does not shorten the data itself.

Quoted large integer

Use when: The digits are an identifier outside ±9007199254740991 and must stay intact.

Trade-offs: The value becomes a JSON string, as in the 58 B quoted sample. A consumer that expects a number will see a string instead.

Schema validation

Use when: You need to know that field names and types match a contract.

Trade-offs: This formatter will still accept syntax-not-schema.json. Use a JSON Schema checker for that question.

When formatting stops

Problem: Paste JSON first.

Likely cause: The input is empty or only whitespace.

What to do: Paste a JSON value, then choose Format or Minify.

Problem: This is not valid JSON. Expected double-quoted property name in JSON at position 23 (line 3 column 1)

Likely cause: invalid-trailing-comma.json has a comma after the last property.

What to do: Remove the trailing comma and format again. The tool leaves the output empty and does not rewrite the input.

Problem: This JSON contains an integer outside JavaScript's safe range. To avoid changing its digits, store that value as a quoted string before formatting.

Likely cause: An unquoted integer is outside ±9007199254740991. The samples are 9007199254740993, 9007199254740992, and -9007199254740993.

What to do: Put the digits in quotes if they must stay exact. A decimal form such as 9007199254740993.0 is still formatted, and the sample changes to 9007199254740992.

Problem: The data parsed, but a field has the wrong type.

Likely cause: syntax-not-schema.json is valid JSON and pages is the string “two”.

What to do: Check the contract or JSON Schema separately. A successful format does not confirm that shape.

Relevant sources

These separate JSON syntax, JavaScript integer range, and JSON Schema.

Frequently asked questions

Does the JSON formatter upload my data?

No. Formatting, minifying, syntax checks, copying, and download generation all run in your browser.

Can this tool fix invalid JSON automatically?

No. It checks JSON syntax and shows parser errors so you can fix the source without guessing what changed. It does not rewrite invalid JSON and it does not validate a schema.

What is the difference between format and minify?

Format adds readable indentation and highlighted tokens for review, while minify removes extra whitespace for compact snippets and payloads.

Why was 9007199254740993 rejected?

As an unquoted integer it is outside JavaScript’s safe range. JSON.parse would turn it into 9007199254740992, so the formatter refuses it and leaves the output empty. Store it as a quoted string when every digit must stay the same.

Does a successful format mean my schema passed?

No. Format and minify confirm JSON syntax. The sample with pages set to the string “two” formats successfully and would still fail a schema that requires a number.