JSON Formatter

The formatted result will appear here...

How to use the JSON Formatter

The JSON Formatter turns compact or messy JSON into a clean, indented tree that is easy to read, check and edit. Everything runs in your browser, so your data is never uploaded to a server.

Step by step

  1. Paste your JSON into the Input JSON box (it appears above the output on small screens).
  2. Click Format JSON. The result appears in the Formatted Output panel as a collapsible tree.
  3. Use the small arrow next to any object or array to collapse or expand it, which helps when working with large documents.
  4. To change a value, click it in the output, type the new value and press Enter. Press Esc to cancel. The input and the output stay in sync.
  5. Click Copy Output to copy the formatted JSON to your clipboard, or Clear to remove everything and start over.

Tips

  • Trailing commas (for example {"a": 1,}) are removed automatically, and an invisible byte-order mark copied from some editors is ignored.
  • Very large integers keep their exact value instead of being rounded.
  • If the JSON is invalid, a red message explains the syntax error so you can fix the input and try again.
  • The formatted output uses 2-space indentation.

Good to know

JSON (JavaScript Object Notation) is a text format for structured data. It is defined by RFC 8259 and is language independent: although it grew out of JavaScript object syntax, nearly every programming language can read and write it. A JSON value is an object (curly braces with key and value pairs), an array (square brackets), a string, a number, true, false or null.

A formatter changes only the whitespace: it never changes the data. A minified response such as {"a":1,"b":[2,3]} and its indented version contain exactly the same information, but the second one is something a person can read and review.

When to use it

  • Reading an API response that arrives on a single line.
  • Finding the missing comma or quote that makes a parser fail.
  • Checking a configuration file before you commit or deploy it.
  • Editing one value in a large document through a tree view instead of searching in text.

Example: Minified input and formatted output (2-space indentation)

Input

{"user":{"id":1,"tags":["a","b"]},"active":true}

Result

{
  "user": {
    "id": 1,
    "tags": [
      "a",
      "b"
    ]
  },
  "active": true
}

Common mistakes

  • Trailing commas, single quotes and comments are not valid JSON, even though many programming languages accept them.
  • Very large integers (above 9007199254740991) may be rounded by programs that use ordinary JavaScript numbers. If exact digits matter, keep such IDs as strings.
  • Do not treat a valid document as a correct one. Syntax checking confirms the structure is well formed, not that the values make sense for your application.

Frequently asked questions

Is my JSON sent to a server?
No. The JSON is parsed and formatted in your browser, so nothing you paste is uploaded or stored on a server.
Why does it show "JSON syntax error"?
JSON has strict rules: keys and text must use double quotes, single quotes are not allowed, keys cannot be unquoted, and comments are not part of JSON. The message shows what the parser found. Fix the input and click Format JSON again.
Does it fix trailing commas?
Yes. A comma before a closing } or ] is removed automatically before parsing, and an invisible byte-order mark at the start of the text (often added by Notepad) is ignored.
Can I change a value in the formatted result?
Yes. Click a value, type the new one and press Enter (Esc cancels). This works for single values such as text, numbers, true, false and null, and the Input box is updated to match. To change the structure, edit the Input and format again.
Does it change very large numbers?
No. Whole numbers that are larger than JavaScript can normally store exactly keep all their digits instead of being rounded.
Is there a minify option?
Not at the moment. The output is always formatted with 2-space indentation.

Related searches: format json online free · json pretty print online · json formatter that does not upload data · check json syntax errors online

Tìm kiếm liên quan: công cụ định dạng json online miễn phí · kiểm tra cú pháp json trực tuyến · sửa lỗi json online · xem json dạng cây online