YAML ↔ JSON Converter

Convert YAML to formatted JSON and JSON to YAML for config files, API examples, and infrastructure snippets.

This conversion runs only in your browser — nothing is uploaded.

  • Input0
  • Output0
  • OptionsYAML → JSON

Input

Output

What is this tool?

This converter moves structured data between YAML and JSON. YAML is common for human-edited Kubernetes manifests, CI workflows, and app config; JSON is common for APIs, schemas, and tooling that expects a single object tree.

Conversion parses the source, then serializes the data in the target format with 2-space indent. That preserves structure and values, but drops comments, original quoting style, and most presentation details. Anchors/aliases are resolved to concrete values.

Use it to inspect a ConfigMap as JSON, turn a JSON fixture into YAML for a workflow file, or debug indentation by comparing shapes—not as a full YAML 1.2 suite or multi-document merger.

Common use cases

  • Round-trip a Kubernetes ConfigMap or Deployment snippet between YAML and JSON
  • Convert CI workflow fragments (GitHub Actions, GitLab CI) for review or embedding
  • Check whether a key is a string ("2") vs a number (2) after YAML typing rules apply

How to use

  1. Choose YAML → JSON or JSON → YAML. Output updates live as you type (debounced for large pastes).
  2. Paste a single document. Streams separated by --- are rejected with a clear error.
  3. Fix any parse error shown above the editors (line and column when available).
  4. Copy the result. Use Swap to flip direction with the current output as the new input.

Examples

Input / settingOutputNotes
name: app → YAML→JSON{\n "name": "app"\n}Simple mapping to formatted JSON.
{"enabled":true} → JSON→YAMLenabled: trueBoolean preserved.
ports:\n - 80\n - 443 → YAML→JSONJSON array under "ports"Sequence → array.
a: 1\n---\nb: 2Multi-document errorSingle document only (edge vs many online converters).

Practical pitfalls

  • Multi-document YAML (---) is out of scope—split files or paste one document at a time.
  • Comments, anchors, and merge keys do not round-trip as authoring syntax; expect resolved data only.
  • YAML may coerce unquoted yes/no/on/off and bare numbers differently than you expect in JSON—quote strings that must stay strings (e.g. Kubernetes "8080").

References

Last reviewed: 2026-07-26

Frequently asked questions

Are YAML comments and anchors preserved?
Comments are dropped because conversion parses data then re-serializes. Anchors and aliases are resolved into concrete values in the output, so the `&name` / `*name` syntax usually does not round-trip as syntax.
Can I convert multi-document YAML with `---`?
No. This tool accepts a single YAML document per conversion. Split the stream or paste one document at a time.
Is this the same as a JSON pretty-printer?
No. YAML ↔ JSON changes format. For pretty-print or minify of strict JSON only, use the JSON formatter tool.
Is my config uploaded?
No. Parsing and conversion run only in your browser.