Skip to content
Data helper

JSON Formatter

Format, minify, and validate JSON instantly by pasting your data.
Pretty-print JSON with consistent indentation or minify it to reduce size, then copy the output with a single click.

This tool helps you quickly detect syntax errors and verify JSON structure, making it ideal for debugging API responses, configuration files, and test data.
Clear formatting improves readability, while minified output is useful
for transmission and storage.

All processing is performed directly in your browser.
No JSON data is sent to any server, ensuring a fast and secure experience
for developers and anyone working with structured data.
When the JSON is invalid, the tool shows the exact line and column of the first error. You can choose the indent, sort keys, accept loose syntax (comments, trailing commas, single quotes, unquoted keys), see counts and depth, and pull out a value with a path such as $.users[0].name.

Tree view

Browse the JSON above as a collapsible tree. Click a key to copy its JSONPath, or search keys and values: matches are highlighted and their parents are opened. Large documents are drawn lazily, so only the parts you open are rendered.

Convert and share

Works on the text in the box above. Flatten nested JSON to one level (or restore it), list every path, turn text into a JSON string (or back), convert NDJSON, or hide values before sharing.

Guide

How to use & features

  • Paste JSON into the input area and click Format or Minify to see the result.
  • If parsing fails, an error message with a line number helps you fix it quickly.
  • Copy or download the formatted output to share with scripts or teammates.
  • All operations run locally—no data is uploaded.
Samples

Sample input & output

Pretty-print JSON

Input
{"name":"Taro","age":28,"active":true}
Output
{
  "name": "Taro",
  "age": 28,
  "active": true
}
FAQ

FAQ

  • What do format and minify do?

    Format adds indentation and line breaks for readability (two-space indent). Minify removes all whitespace and line breaks to make one line. The values themselves are not changed.
  • How are errors shown?

    The line and column of the first error, the full text of that line and a ^ pointing at the spot, and the position is also selected in the input. The position is worked out by the tool itself, so you get the same line and column in every browser. Check the brackets, commas and quotes near it.
  • Can I use comments or trailing commas?

    Yes, if you turn on Accept loose syntax. Comments, trailing commas, single quotes and unquoted keys (and Python True / False / None) are fixed before formatting, and the output is standard JSON. With it off they are errors, because standard JSON does not allow them.
  • Is key order preserved?

    In most cases it stays as entered. However, keys that look like integers, such as `"1"` and `"2"`, are moved to the front in ascending order, as JavaScript specifies.
  • What happens if a key appears twice?

    The later one stays and the earlier one is dropped. It is not an error, so check the formatted result.
  • Is my JSON sent anywhere?

    No. Formatting, minifying and validating all happen in your browser.
Use cases

Common use cases

  • Making API responses and log JSON readable

    Format long one-line JSON so you can follow its structure by eye.
  • Checking the syntax of config files

    Confirm that `package.json` or an app's JSON settings have valid syntax before applying them.
  • Minifying JSON to embed it

    Strip extra whitespace to put JSON in a `curl -d` argument, an environment variable or a string in test code.
  • Finding where a syntax error is

    Use the position in the error message to find a missing comma or a missing closing bracket.
Notes

Notes & limitations

  • Comments and trailing commas are fixed only when loose syntax is on

    At first only standard JSON is accepted, so comments, trailing commas, single quotes and unquoted keys cause an error. Turn on Accept loose syntax and they are fixed before parsing (the output is standard JSON and the comments are dropped). Not every JSON5 feature is supported.
  • Number notation can change

    The input is parsed and written back, so `1.0` becomes `1` and `1e3` becomes `1000`. Large integers that JavaScript cannot represent exactly are rounded. Keep IDs as strings to be safe.
  • Mind key order and duplicate keys

    Integer-like keys are moved to the front. If a key appears more than once, only the last value remains.
  • Character escapes change

    `\u00e9` becomes `é` and `\/` becomes `/`. The meaning is the same, but a diff against the original text may show differences.
About

About this tool

JSON Formatter and Validator

JSON is used everywhere in APIs, configuration files, logs, fixtures, and NoSQL documents, but a single missing comma or quote can break parsing. This browser-based JSON formatter helps you paste JSON, make it readable with indentation, and check syntax errors without sending the data to a server.

Common use cases

  • Inspect API responses: Turn minified JSON into a readable tree-like structure for debugging.
  • Validate configuration files: Catch syntax errors before deploying JSON-based settings.
  • Prepare review snippets: Format JSON before sharing it in issues, pull requests, or documentation.

Things to watch

JSON does not support comments, and values such as "1" and 1 are different types. When you format or validate JSON, also check whether strings, numbers, booleans, arrays, objects, and null match the API or configuration schema you expect.

Articles for this tool

Recent Articles