LocalExcelTool
はじめる

JSON 整形

JSONを読みやすい形式に整形。インデント2スペース。

JSON 整形とは

JSON整形とは、圧縮されたJSONに適切な改行とインデントを追加して可読性を高める処理です。設定ファイルやAPIレスポンスの確認に便利です。

🔒 処理はすべてブラウザ内で完結し、データは送信されません。

このツールの前提

処理場所
このページのブラウザ内(JavaScript / Canvas)
アップロード
なし — ファイルは端末の外に出ません
オフライン
ページを開いた後は通信不要

Parsing first, printing second

The input is passed through JSON.parse and re-serialised with two-space indentation. Because it is a real parse rather than a text reformatter, anything JSON does not allow is rejected with a position — trailing commas, comments, single-quoted strings, unquoted keys, and NaN all fail here even though JavaScript source accepts them.

The error message names a character offset, which is the practical way to find the problem: count to that offset in the original string. Most failures are a trailing comma before a closing brace, or a smart quote introduced by a word processor when the payload was copied out of a document.

What the round trip silently changes

Comments are gone, because JSON has no comments — if the source used JSONC or JSON5, they are not recoverable from the output. Duplicate keys collapse to the last occurrence. Key order is preserved for string keys, but integer-like keys are reordered first, since JavaScript objects treat them as array indices.

Numbers are the dangerous part. Anything beyond 2^53 loses precision: 12345678901234567890 comes back as 12345678901234567000. Snowflake IDs, Twitter/X IDs, database bigints and Ethereum wei values are all in that range, and the corruption is silent. If the payload carries large integers, treat them as strings at the source rather than reformatting them here.

Formatting is not validation

A document that parses is syntactically valid JSON, not correct data. Duplicate keys, wrong types, missing required fields and a number where a string was expected all pass. If you need schema checking, that is a separate step with a JSON Schema validator.

The practical limit is size: parsing builds the entire object in memory, so a multi-megabyte document is fine and a hundred-megabyte one will freeze the tab. For files that large, use a streaming formatter rather than a browser page.

使い方

  1. 1.JSONを貼り付け
  2. 2.「整形する」をクリック
  3. 3.整形結果をコピー

他の方法との比較

同じ変換をする方法は 3 つあります。ブラウザ内(このページ)、サーバー側の変換サービス、デスクトップアプリ。差がつくのは速度ではなく、ファイルがどこへ行くかと、無料でどこまでできるかです。

観点このツールサーバー側の変換サービス
ファイルの処理場所このページのブラウザ内ベンダーのサーバー(アップロード後)
アカウント不要多くの場合必要(無料枠の制限解除に登録を求める)
無料で扱えるサイズサイズ制限なし(回数制限もなし)数ファイル/時間、または 5〜10MB 程度で課金 wall
料金無料。Pro は月 $9(大きいファイルと AI 機能のみ)サブスクが一般的。おおむね月 $7〜15(2026 年 11 月時点)
オフライン一度開けば通信不要不可
20MB を処理し始めるまで待ち時間なし(アップロードが無い)アップロードが支配的(10Mbps 上りで約 16 秒)
保証できないこと不正な入力は「修復」せず、パーサのエラー位置を返します同じ(変換の原理は変わらない)

サーバー側のサービスが優れている点は明確にあります。巨大なファイル、チームでの共有、変換履歴の管理、スクリプトからの自動化。逆に「1 回だけ、手元のファイルを別形式にしたい」という今回の用途では、アップロードの待ち時間と登録の手間だけが増えます。

よくある質問

JSON整形とは?

改行やインデントを整理して、JSONを人間が読みやすくします。

不正なJSONは?

構文エラーがある場合、エラー内容を表示します。

データは送信されますか?

いいえ、ブラウザ内で処理します。

この変換で失われるもの

フォーマッタは入力を構文木に解析し、一貫したインデントで出力します。入力が不正なら、黙って壊れたファイルを返すのではなく、パーサのエラー位置を表示します。壊れた JSON は「修復」されず、そのまま壊れたまま示されます。

その他のフォーマット