YAML ↔ JSON Converter

Convert between YAML and JSON with automatic direction detection.

Converter Media & Files Updated Apr 19, 2026
How to Use
  1. Paste YAML or JSON content into either input area.
  2. The direction auto-detects — paste YAML on the left, JSON appears on the right (or vice versa).
  3. For multi-document YAML files (separated by <code>---</code>), each document becomes an array element in JSON.
  4. Click Swap to flip the input/output panes.
  5. Click Copy to put the converted output on your clipboard.
  6. Errors show line and column with hints about what went wrong.
Input
Output
Waiting
Paste YAML or JSON.

Notes

Detection
Starts with { or [ = JSON
Numbers
Auto-typed in YAML
Bool
true / false / yes / no
Null
null / ~ / empty
Strings
Quoted if needed
Multi-doc
--- → JSON array

Frequently Asked Questions

What's the difference between YAML and JSON?

Both encode the same data structures (objects/maps, arrays, scalars). YAML prioritizes human readability — indentation-based, supports comments, multi-line strings, anchors for repeated content. JSON prioritizes machine parsing — minimal syntax, no comments, every program in every language can parse it. They're interchangeable for data; YAML is more popular for hand-written config, JSON for API interchange.

Which YAML features are supported?

Standard mappings, sequences, scalars (strings, numbers, booleans, null), block and flow styles, multi-line strings (|, >), anchors (&) and aliases (*), and multi-document (---) syntax. Custom YAML tags (!!str, !!python/object, etc.) are recognized but rarely round-trip cleanly through JSON. Use the converter for data, not as a full YAML AST processor.

How do I convert Kubernetes YAML to JSON?

Paste the YAML manifest. K8s YAML is well-formed YAML 1.2 and converts cleanly. Multi-resource files (multiple --- separated documents) become an array. K8s API and kubectl both accept JSON, so this is sometimes useful for templating or inspection.

Why does YAML lose data going through JSON?

JSON has no comments — they're discarded. YAML's anchors and aliases get expanded inline. Multi-line strings collapse to single-line escaped strings. The data is preserved; the formatting and developer-friendly features are lost. For lossless round-tripping, you need a YAML-to-YAML formatter, not a YAML/JSON converter.

What about TOML or HCL?

Out of scope here. TOML is similar in spirit to YAML and JSON but has its own grammar. HCL (HashiCorp Configuration Language, used by Terraform) is more complex with expressions and references. Use dedicated converters for those — many CLI tools (yq, taplo) handle them well.

Is my config uploaded?

No. Conversion runs entirely in your browser — your YAML/JSON is never transmitted. Safe for production CI configs, infrastructure manifests, and config files containing secrets you'd rather not paste into a cloud tool.

Common Use Cases

CI/CD pipeline configuration

Convert GitHub Actions, GitLab CI, or CircleCI YAML to JSON for inspection or programmatic processing.

Kubernetes manifests

View manifests as JSON for processing with jq or for systems that prefer JSON input.

Configuration migration

When migrating between systems that use different config formats (Spring's application.yml vs application.json).

API testing

Some APIs accept either format — convert your YAML test fixtures to JSON for tools that don't parse YAML.

Documentation generation

Embed config examples in docs as JSON for readers who don't know YAML, or vice versa.

Schema work

JSON Schema is JSON; convert your example YAML inputs to JSON to test against schemas.

Last updated: