JSON Formatter

Beautify minified JSON with 1 to 8 spaces of indentation. Validates syntax, then copy the result or download formatted.json. Paste or open a file. Private.

Everything runs in your browser. Nothing you enter is uploaded or saved.

Your result

How to use JSON Formatter

  1. Paste your JSON into the JSON box, or press Open a text file to load a local .txt, .csv, .json, .md, .html, .xml or .log file of up to 5 MB.
  2. Enter the number of spaces you want in Indent spaces (1–8); 2 and 4 are the most common.
  3. Press Process to parse and format the JSON.
  4. If an error appears, fix the reported issue, such as single quotes or a trailing comma, and press Process again.
  5. Press Copy result to copy the formatted JSON, Download to save it as formatted.json, or Reset to clear the inputs.

Supported formats and limitations

Input
Text typed or pasted into the form, or a local .txt, .csv, .json, .md, .html or .xml file
Output
Result on screen, with one-click copy
Works on
Any modern browser on Windows, macOS, Linux, Android and iOS. JavaScript must be enabled.

Important limitations

Very large inputs (over one million characters) are rejected to keep the page responsive. Unicode text is supported; visual grapheme clusters such as some emoji count as several characters.

Privacy and file processing

Everything runs in your browser. Nothing you enter is uploaded, stored or logged by this website.

About JSON Formatter

Minified JSON from an API response, log file or configuration export is hard to read on one long line. This JSON Formatter parses your data and rewrites it with clean line breaks and the indentation you choose, from one to eight spaces. Nested objects and arrays are laid out level by level, making it easy to spot keys, values and structure at a glance.

Because the input is properly parsed, the formatter doubles as a quick syntax check: if your text is not valid JSON, you get a clear message instead of a half-formatted result. Single quotes, comments and trailing commas are rejected, as the JSON standard requires. The data is never executed and never uploaded; you can load a .json file straight from your computer and download the formatted result as formatted.json.

Features

  • Formats any valid JSON value: objects, arrays, strings, numbers, booleans or null.
  • Lets you choose an indentation of 1 to 8 spaces.
  • Validates syntax and shows a clear message for comments, trailing commas and unquoted or single-quoted keys.
  • Rejects data nested more than 100 levels deep to keep the browser responsive.
  • Parses JSON safely without executing it, with input up to 1,000,000 characters.

Why use it

  • Makes API responses and config files readable for debugging and code review.
  • Catches syntax errors before you deploy a configuration or send a request.
  • Matches your team's indentation style and saves the result as a ready-to-use formatted.json file.
  • Keeps tokens, keys and customer data on your own device.

How it works

JSON.parse → bounded-depth inspection → JSON.stringify with the selected indentation.

Examples

Minified object with 2-space indent

Input: {"name":"Toolnest","local":true} with Indent spaces 2

Result: {
"name": "Toolnest",
"local": true
}
Valid JSON. Parsed and re-serialized, never executed. Duplicate keys keep the last value; numbers use JavaScript precision.

Nested data with 4-space indent

Input: {"a":[1,2],"b":{"c":null}} with Indent spaces 4

Result: {
"a": [
1,
2
],
"b": {
"c": null
}
}
Valid JSON. Parsed and re-serialized, never executed. Duplicate keys keep the last value; numbers use JavaScript precision.

JSON Formatter: frequently asked questions

Why does my JSON show an error?

The most common causes are single quotes instead of double quotes, keys without quotes, comments, and a comma after the last item in an object or array. These are allowed in JavaScript but not in JSON. The tool reports that the input is invalid and reminds you of these rules; correct the text and press Process again.

Can it minify or sort JSON keys?

No. This tool only beautifies, with the indentation you set in the Indent spaces field. Keys stay in the order they were parsed and are not sorted alphabetically. To produce compact single-line JSON, use a dedicated JSON minifier. The formatted output is still valid JSON that you can paste back into code or a configuration file.

What happens to duplicate keys?

When the same key appears more than once in an object, only the last value is kept, which is how standard JSON parsers in browsers behave. For example, {"a":1,"a":2} is formatted as an object containing only "a": 2. The tool does not warn you about duplicates, so compare the output with your original if keys might repeat.

Will very large numbers stay exactly the same?

Not always. Numbers are read using standard JavaScript precision, so integers beyond about 9 quadrillion can lose their final digits. For example, 12345678901234567890 is shown as 12345678901234567000. Number spellings may also change, such as 1.0 becoming 1. If your data contains long IDs, store them as strings in the JSON to keep them exact.

Is there a size or nesting limit?

Input can be up to 1,000,000 characters, which covers most API responses and config files. Data nested more than 100 levels deep is rejected with a message, since extreme nesting can freeze a browser tab. For larger files, split the data or use a desktop editor. Everything runs locally, so formatting speed depends on your device.