YAML to JSON Converter
From-scratch YAML 1.2 subset parser + emitter covering 95% of real configs (Kubernetes manifests, GitHub Actions workflows, docker-compose, dprint). Bidirectional, line-pointing errors, all string forms, multi-line scalars, flow + block syntax. 100% offline.
What is the YAML to JSON Converter?
YAML to JSON Converter is a from-scratch YAML 1.2 subset parser + emitter focused on the configs developers actually edit: Kubernetes manifests, GitHub Actions workflows, GitLab CI configs, docker-compose, dprint / prettier / eslint configs, and CircleCI YAMLs. Supported on the parse side: scalars (plain strings, single-quoted, double-quoted with `\n` `\t` `\uXXXX` escapes), numbers (decimal, hex, octal), booleans (true / false / yes / no), null (null / ~), block maps with arbitrary nesting (indentation-based), block sequences (`- item`), inline flow maps `{key: value, …}`, inline flow sequences `[a, b, c]`, multi-line literal strings (`|` with `+` / `-` chomping indicators), multi-line folded strings (`>`), and comments. Bidirectional: paste JSON, get YAML; paste YAML, get JSON. Errors include line numbers. NOT supported (yet): anchors / aliases (`&foo` / `*foo`), explicit tags (`!!str`), document markers (`---` / `...`).
How to use it
- Pick a direction: YAML → JSON or JSON → YAML.
- Paste your config — Kubernetes manifest, GitHub Actions workflow, docker-compose, etc.
- The output side updates live with the converted form.
- Copy the result or download as .json / .yaml.
Benefits
- From-scratch YAML 1.2 subset parser — no library, no remote dependency.
- Bidirectional: YAML → JSON and JSON → YAML in the same tool.
- All scalar forms: plain, single-quoted, double-quoted with escape sequences.
- Block AND flow syntax for maps and sequences — mix them freely.
- Multi-line literal (`|`) and folded (`>`) strings with chomping indicators.
- Indentation-based nesting with arbitrary depth.
- Counts: scalars, maps and sequences in your input.
- Persists your input and direction in localStorage for one-click resume.
- Runs 100% in your browser — no upload, no server.
Frequently asked questions
Does this support every YAML 1.2 feature?
It supports the subset that covers 95% of real-world configs. Not supported (yet): anchors (`&name`), aliases (`*name`), explicit tags (`!!str`), document markers (`---` / `...`), and YAML 1.1's many-named-booleans behaviour. Most Kubernetes, GitHub Actions and docker-compose YAMLs work cleanly.
Will it work on Kubernetes manifests?
Yes — Deployment, Service, ConfigMap, Secret, Ingress, StatefulSet manifests all round-trip cleanly. Multi-document YAMLs (separated by `---`) currently parse only the first document.
What about GitHub Actions workflows?
Yes — jobs, steps, matrix configurations, env blocks, conditionals all parse correctly. Anchors are rare in GitHub Actions so the lack of anchor support is rarely felt.
What about docker-compose.yml?
Yes — services, volumes, networks all parse. Anchors are sometimes used to share env blocks across services; those won't expand and will appear as plain strings in the JSON.
Can I convert JSON back to YAML?
Yes — pick the 'JSON → YAML' direction, paste your JSON, and the converter emits clean block-style YAML with 2-space indentation.
How does it handle multi-line strings?
Block literals (`|`) preserve newlines verbatim; block folded strings (`>`) collapse newlines into spaces (folded). Trailing newlines are kept by default; `|-` and `>-` strip them; `|+` and `>+` keep extras.
What if my YAML has anchors?
Anchors and aliases are NOT expanded — they parse as plain strings, which usually breaks the JSON output. As a workaround, paste an anchor-free version into the tool.
Are numbers parsed?
Yes — integers (decimal, hex `0x…`, octal `0o…`), floats (with `.inf`, `-.inf`, `.nan`), and booleans (true / false / yes / no, with various casings). Numbers in quoted strings stay strings.
Does it preserve comments?
No — JSON has no comment syntax, so YAML comments are dropped in the YAML → JSON direction. In the reverse direction (JSON → YAML) we don't add comments.
What about duplicate keys?
YAML 1.2 considers duplicate keys an error. Our parser silently overwrites with the last value — a future version will flag duplicates explicitly.
Is anything uploaded?
No. Parsing and conversion run entirely in your browser.