TOMLコンバーター
TOML と JSON を相互変換。設定ファイルの確認に。
TOMLコンバーターとは
TOMLコンバーターは、TOML と JSON を相互変換するツールです。Rust や Python の設定ファイル(Cargo.toml、pyproject.toml など)の中身を JSON で確認したり、JSON から TOML を生成したりできます。@iarna/toml ライブラリを使用し、エラーは行情報付きで表示します。処理はブラウザ内で完結します。
🔒 処理はすべてブラウザ内で完結し、データは送信されません。
このツールの前提
- 処理場所
- このページのブラウザ内(JavaScript / Canvas)
- アップロード
- なし — ファイルは端末の外に出ません
- オフライン
- ページを開いた後は通信不要
A configuration format with real types
TOML has actual dates, integers, floats and booleans, unlike INI where everything is a string. A bare 2026-11-26T09:00:00Z parses as a datetime, not as text — useful for config validation, and a surprise when a value that looks like a version (1.10) is read as a float and loses its second dot.
There is no null in TOML: absence of a key is the only way to express nothing. That is a genuine difference from JSON and YAML, and it means a serialiser emitting null has to drop the key, which loses the distinction between 'unset' and 'explicitly empty'.
Table ordering and array-of-tables
Standard tables are declared with [name] and belong to whichever table header precedes them; array-of-tables entries with [[name]] append to a list in file order. Reordering a file can therefore change the meaning, which is why a formatter must preserve document order rather than sorting keys.
Dotted keys and quoted keys interact: a.b = 1 inside [t] defines t.a.b, while "a.b" = 1 defines a key literally named a.b. Getting those confused produces configuration that parses cleanly and is read as something entirely different by the application.
What to check after editing
Duplicate keys are an error in TOML rather than a last-one-wins situation, which is a feature — it catches the merge accident that silently overrides a value in JSON. If a tool accepts duplicates without complaint, it is not following the spec.
Multi-line strings (""" … """) preserve newlines but trim the first one after the opening delimiter, and a trailing backslash removes the following newline. Both details matter for embedded scripts, and both are easy to break with an editor that reindents automatically.
使い方
- 1.TOML か JSON を貼り付け
- 2.変換方向を選択
- 3.実行して結果をコピー
TOMLコンバーターの仕組み
整形ツールは入力を構造として解析し、一貫したインデントで再出力します。構文エラーが見つかるのも同じ理由です。解析できなければ出力もできません。
- 1
木構造へ解析
JSON は JSON.parse、YAML・XML・CSS・SQL はそれぞれのパーサを使います。解析は構造を返すか、行と列を指して失敗するかのどちらかです。
- 2
固定した様式で再出力
インデント幅・キー順・引用の扱いを決定的に適用するため、同じ入力を 2 回整形しても同じバイト列になります。
- 3
エラー位置を示す
解析に失敗したときは位置を含むメッセージを出すので、当て推量ではなく明確に修正できます。
処理の流れ
整形は検証ではない
整形が証明するのは「構文として解析できる」ことだけです。スキーマに対する妥当性や業務ルールは検証しません。重複キーを持つ JSON は正常に解析され、最後の値が黙って採用されます。
何が正規化されるか
コメントは CSS と SQL では保持されますが、コメント構文の無い JSON では失われます。YAML のアンカーは展開され、引用符の種類が変わることがあります。署名対象などバイト配置が重要な場合は元ファイルを保管してください。
自分で確かめる
整形は決定的かつローカルです。2 回実行して比較してください。
- 1.このページで DevTools を開き、Network タブを選ぶ
- 2.フィルタを Fetch/XHR に設定したままツールを実行する
- 3.ファイルの中身を含むリクエストが 1 件も無いことを確認する(ページの読み込みとフォントだけが表示されます)
よくある質問
どの方向に変換できる?
TOML→JSON と JSON→TOML の両方に対応しています。JSON→TOML はトップレベルがオブジェクトである必要があります。
どんな用途に?
Cargo.toml や pyproject.toml の内容確認、CI 設定の検証、TOML 学習などに使えます。
この変換で失われるもの
フォーマッタは入力を構文木に解析し、一貫したインデントで出力します。入力が不正なら、黙って壊れたファイルを返すのではなく、パーサのエラー位置を表示します。壊れた JSON は「修復」されず、そのまま壊れたまま示されます。