.toml
Code
TOML (Tom's Obvious Minimal Language)
TOMLは明確さとシンプルさのために設計された設定ファイルフォーマットです。ハッシュテーブルに曖昧さなくマッピングされ、人間が読み書きしやすいです。TOMLはRustのCargo.tomlとPythonのpyproject.tomlの標準フォーマットです。
MIMEタイプ
application/toml
種類
テキスト
圧縮
無劣化
メリット
- + Unambiguous — no implicit type coercion unlike YAML
- + Native datetime support without quoting
- + Simple, flat structure that maps directly to hash tables
- + Standard in Rust and Python ecosystems
デメリット
- − Deeply nested data structures become verbose
- − Less widespread tool support compared to JSON and YAML
- − No standard way to represent null values
.TOMLを使うタイミング
設定ファイルにTOMLを使用してください — 特にRust(Cargo.toml)やPython(pyproject.toml)エコシステムで。曖昧さのないパースが重要な場合に最適です。
技術的詳細
TOMLはキーと値のペア、テーブル(角括弧内のセクション)、テーブルの配列(二重角括弧)、datetime、整数、浮動小数点数、ブール値、文字列を含むネイティブ型の値を使用します。インデントは意味を持ちません。
歴史
Tom Preston-Werner(GitHub共同創設者)は、YAMLやJSONに代わる設定ファイルの最小限の代替として2013年にTOMLを作成しました。TOML 1.0は広範なコミュニティのフィードバックを経て2021年1月にリリースされました。