メインコンテンツへスキップ
Z

What is YAML?

YAML (YAML Ain't Markup Language) is a human-friendly, indentation-based data serialization format used mainly for configuration files. It represents the same data as JSON — scalars, lists and mappings — but with cleaner syntax, comments and multi-line strings, making it popular in CI/CD, Docker and Kubernetes.

YAML uses indentation (spaces, never tabs) to show structure instead of brackets. Mappings are key: value, lists use -, and it supports comments (#), multi-line strings and anchors/references for reuse. Because YAML is a superset of JSON, any JSON is valid YAML.

Its readability makes it the default for human-edited configuration — GitHub Actions, Docker Compose, Kubernetes manifests — where comments and clean diffs matter.

YAML tools

よくある質問

文字列が引用符で囲まれる場合と囲まれない場合があるのはなぜですか?

js-yamlは、他のデータ型(数値・真偽値・日付など)と誤解釈されるおそれのある文字列や、特殊文字を含む文字列にのみ引用符を付けます。可読性を優先し、引用符なしの表記が可能な場合はそちらが選ばれます。

キーの順序は保持されますか?

はい、デフォルトではJSONオブジェクトの元の順序がそのまま保持されます。アルファベット順にしたい場合は「キーをソート」を有効にしてください。

非常に深いネスト構造にも対応していますか?

js-yamlに明確な上限はありませんが、ネストが極端に深い場合(100階層超など)、JavaScriptエンジンの再帰処理の限界に達する可能性があります。