YAML から JSON への変換

逆方向の変換が必要ですか?
JSON to YAML Converter

YAML 入力

1

JSON 出力

YAML データを入力して JSON に変換

変換後のデータはここに表示されます

YAML を JSON に変換する方法(オンライン)— ステップ別ガイド

この YAML→JSON 変換ツールで、設定ファイル、Kubernetes マニフェスト、CI/CD 設定を JSON に変換して API やツールで扱いやすくします。

  1. ステップ 1 – YAML を貼り付け/アップロード

    • 左のエディタに YAML を貼り付けるか、.yaml / .yml をアップロードします。
    • Kubernetes、Docker Compose、GitHub Actions などの YAML に対応します。
    • --- 区切りのマルチドキュメント YAML は JSON 配列に変換されます。
  2. ステップ 2 – 変換結果を確認する

    • 右側に JSON が表示され、入れ子構造と型をできる限り保持します。
    • YAML のコメントは削除されます(JSON はコメント非対応)。
    • 配列・オブジェクト・スカラーが正しく変換されているか確認します。
  3. ステップ 3 – 例外ケースを扱う

    • 複雑な YAML ではアンカー/エイリアスの調整が必要になる場合があります。
    • 真偽値(true/false、yes/no)は JSON の真偽値に正規化されます。
    • 数値と文字列は JSON 形式で保持されます。
  4. ステップ 4 – JSON をコピー/ダウンロード

    • 「コピー」で JSON をクリップボードへ送ります。
    • または「ダウンロード」で .json として保存します。
    • REST API、フロントエンド、JSON 入力を必要とするツールで利用できます。

Quick tips for YAML to JSON

  • Ensure indentation is consistent in your YAML; most conversion errors come from bad indent levels.
  • Multi-document YAML will be converted to a JSON array, which is ideal for lists of configs or resources.
  • After converting, run the JSON through the validator or formatter to catch any remaining structural issues.
Example: YAML to JSON
# YAML input
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  database_url: postgres://localhost/db
  debug: true
  ports:
    - 8080
    - 8081

// JSON output
{
  "apiVersion": "v1",
  "kind": "ConfigMap",
  "metadata": {
    "name": "app-config"
  },
  "data": {
    "database_url": "postgres://localhost/db",
    "debug": true,
    "ports": [8080, 8081]
  }
}

Related YAML & JSON tools

Convert between formats and work with configuration files using these complementary tools.

よくある質問

What YAML features are supported in the conversion?

The converter supports standard YAML features including scalars, sequences (arrays), mappings (objects), multi-line strings, and basic YAML syntax. Complex YAML features like anchors and references may have limited support.

How are YAML comments handled during conversion?

YAML comments are typically stripped during conversion to JSON since JSON doesn't support comments. The conversion focuses on the data structure rather than preserving comments.

Can I convert complex nested YAML structures?

Yes, the converter can handle deeply nested YAML structures with multiple levels of objects and arrays. The resulting JSON will maintain the same hierarchical structure.

What happens to YAML data types during conversion?

YAML data types are converted to their JSON equivalents: strings remain strings, numbers become JSON numbers, booleans stay as booleans, and null values are preserved. YAML's additional data types are converted to their closest JSON representation.

YAML から JSON への変換 | JSONSwiss