JSON ↔ YAML 변환기
브라우저에서 JSON과 YAML을 즉시 변환합니다.
이 도구에 대해
JSON 또는 YAML을 패널에 붙여넣으면 다른 패널에서 즉시 변환됩니다. 객체, 배열, 문자열, 숫자, 불리언 및 null을 지원합니다. 2칸 또는 4칸 들여쓰기를 선택하고 한 번의 클릭으로 결과를 복사하세요.
사용 방법
- 1 1단계: 왼쪽 패널에 JSON을 붙여넣으면 오른쪽에 자동으로 YAML이 표시됩니다.
- 2 2단계: 또는 오른쪽 패널에 YAML을 붙여넣으면 왼쪽에 JSON이 표시됩니다.
- 3 3단계: 패널 위의 토글을 사용하여 들여쓰기를 2칸 또는 4칸으로 선택하세요.
- 4 4단계: 어느 패널에서나 복사를 클릭하여 결과를 클립보드에 복사하세요.
JSON and YAML: the same data, two notations
JSON and YAML both describe the same underlying structures — objects (key/value maps), arrays (ordered lists), strings, numbers, booleans, and null. They differ only in how that structure is written on the page. JSON uses explicit braces, brackets, quotes, and commas, which makes it unambiguous for machines but noisy for humans. YAML uses indentation and dashes instead of brackets, which makes it cleaner to read and edit by hand. Because the data model is shared, converting between them is a matter of re-rendering the same tree in the other syntax, not changing what the data means. This tool converts JSON to YAML, and with the swap button, YAML back to JSON.
How the conversion works
Converting JSON to YAML happens in two steps. First the tool parses your JSON text into an in-memory data structure — this is also your validation step, because invalid JSON fails to parse and the tool shows the error. Second, it walks that structure and writes YAML: objects become key: value lines, arrays become - item lines, and nesting is expressed by indentation (2 or 4 spaces, your choice). Going the other direction, the tool parses the indentation-based YAML into the same kind of structure and serialises it back out as JSON.stringify with your chosen indent.
A key subtlety is string quoting. Most strings in YAML need no quotes, but some must be quoted to avoid being misread. The tool automatically quotes a string when it is empty, contains YAML-special characters (such as : # [ ] { } , & *), looks like a boolean or number (true, no, 42), or contains a newline. This prevents the classic bug where the value no is silently interpreted as the boolean false.
A worked example
Paste this JSON:
{ "name": "api", "ports": [80, 443], "tls": true }
With 2-space indentation the tool produces:
name: apiports: - 80 - 443tls: true
Notice the braces, brackets, quotes, and commas are gone. The object's keys become plain lines, the array becomes a dashed list indented under ports, and the boolean stays unquoted. Click swap and the YAML round-trips back to equivalent JSON.
The trap that makes YAML famous: indentation
In JSON, structure is defined by brackets, so whitespace is cosmetic. In YAML, indentation is the structure. Two spaces vs. three spaces, or a stray tab, changes which object a key belongs to. The two most common YAML mistakes are:
- Tabs instead of spaces. YAML forbids tabs for indentation. Always indent with spaces — this tool emits spaces and you should too.
- Inconsistent indent levels. Mixing 2-space and 4-space indentation in the same file breaks parsing. Pick one (the radio buttons here let you standardise) and keep it consistent.
Scope and limitations
This is a lightweight, dependency-free converter built for the common cases you meet in config files: nested objects, arrays, scalars, and the standard quoting rules. It does not implement every corner of the YAML 1.2 specification — advanced features such as anchors and aliases (&/*), explicit type tags, multi-document streams (--- separators), and multi-line block scalars (| and >) are outside its scope. For routine API payloads, Kubernetes-style manifests, and CI configuration it handles the job; for exotic YAML, validate with a full parser.
Use cases and privacy
- Config conversion. Turn a JSON settings file into the YAML many tools and CI systems prefer.
- Readability. Convert a dense JSON response to YAML to read or diff it more easily, then convert back.
- Learning. Paste familiar JSON and watch the YAML equivalent to learn the syntax mapping.
- Quick validation. Because conversion requires parsing, a successful convert confirms your JSON or YAML is well-formed.
Both directions run entirely in your browser. Your data — which often includes API keys, hostnames, or internal config — is never uploaded, so the tool works offline and keeps sensitive values on your own machine.