EasyTools Logo

JSON Formatter: Paste messy JSON, tidy it up in one click! | EasyTools

Input JSON
Output
https://easytools.bgflow.net/en/tools/json-formatter
這個工具有解決您的問題嗎?
贊助商連結
贊助商連結

常見問題

What does "fuzzy input" mean?

Standard JSON parsers are very strict about syntax — for example, a trailing comma after the last element isn't allowed. This tool automatically cleans up these common mistakes before parsing, including trailing commas and JavaScript-style single-line and multi-line comments, so you don't have to fix them by hand.

What is JSONL?

JSONL (JSON Lines) is a format with one JSON object per line, commonly used for logging, streaming data, and large datasets. When "Output as JSONL" is enabled, if the outermost input is an array, the tool splits each element onto its own line.

How do I format quickly?

Paste your JSON into the input box and click "Format", or use the keyboard shortcut Ctrl+Enter (Cmd+Enter on Mac).

How do I expand arrays across multiple lines?

Check "Expand Array Indentation" to make each array element occupy its own line according to the indent setting. By default this is unchecked, so arrays stay on one line — handy for reading short lists.

How to Use

  1. Paste your JSON into the input box on the left (top on mobile).
  2. Choose the indent size (default 4 spaces), or choose Tab indentation.
  3. To expand arrays across multiple lines, check “Expand Array Indentation” (arrays stay on one line by default).
  4. To output JSONL, check “Output as JSONL”.
  5. Click “Format” (or press Ctrl+Enter).
  6. The formatted result appears on the right (bottom on mobile) — click “Copy” to copy it to the clipboard.

Supported Fuzzy Input

This tool automatically fixes the following common issues before parsing:

  • Trailing commas: e.g. a , after the last array element
  • Single-quoted strings: automatically converted to double quotes
  • Unquoted keys: e.g. {name: "Alice"} → {"name": "Alice"}
  • JavaScript-style comments: automatically strips // single-line and /* */ multi-line comments

What Is JSONL?

JSONL (JSON Lines) puts one complete JSON object per line, for example:

{"id": 1, "name": "Alice"}
{"id": 2, "name": "Bob"}

Common uses: log analysis, importing large datasets, streaming API output.

Example

Input (with a trailing comma):

{
  "name": "Alice",
  "scores": [95, 87, 92,],
}

Formatted (4-space indent, arrays stay on one line by default):

{
    "name": "Alice",
    "scores": [95,87,92]
}

After checking “Expand Array Indentation”:

{
    "name": "Alice",
    "scores": [
        95,
        87,
        92
    ]
}