Skip to main content
SiteIndex
開発者向けすぐに利用できます

YAMLをJSONに変換

設定ファイルやAPIの作業向けに、YAMLを検証しながらすぐにJSONへ変換します。

使い方ガイド

ツール操作エリア

アカウント不要
YAMLからJSONへ変換

YAML 1.2 mappings and sequences, including nested lists and multiline strings. Comments are omitted from JSON. Duplicate or non-string keys, custom tags, cycles, and values JSON cannot represent produce errors instead of silent data loss. Multi-document files (separated by ---, such as Kubernetes manifests) convert to a JSON array of documents.

You can also drag and drop a .yaml or .yml file onto the input. Conversion runs as you type.

How values are typed (YAML 1.2 core schema)

This converter follows the YAML 1.2 core schema, so words that YAML 1.1 tools turn into booleans stay strings here — the classic “Norway problem”: country: NO converts to {"country": "NO"}, and yes, on and off also stay strings. Hex (0x1A) and octal (0o17) integers do become numbers. Anchors and aliases are expanded into plain values, comments are dropped, and an integer beyond JavaScript's safe range must be quoted in the YAML so it is preserved as text instead of losing precision.

Python (PyYAML)
import json, yaml

data = yaml.safe_load(open('config.yaml'))
print(json.dumps(data, indent=2))
JavaScript (js-yaml)
import { load } from 'js-yaml';

const data = load(yamlText);
console.log(JSON.stringify(data, null, 2));
Command line (yq)
yq -o=json '.' config.yaml
YAMLからJSONへ変換とは

設定ファイルやAPIの作業向けに、YAMLを検証しながらすぐにJSONへ変換します。

使い方

設定ファイルやAPIの作業向けに、YAMLを検証しながらすぐにJSONへ変換します。

よくある用途

設定ファイルやAPIの作業向けに、YAMLを検証しながらすぐにJSONへ変換します。

利用上の注意

結果はブラウザー、ネットワーク、入力内容、外部サービスによって異なる場合があります。このツールは情報提供を目的としており、専門的な診断や助言に代わるものではありません。

よくある質問
YAMLからJSONへ変換とは
設定ファイルやAPIの作業向けに、YAMLを検証しながらすぐにJSONへ変換します。

関連ツール