Convert YAML to JSON
Anchors, multi-doc,
all types supported.
Free YAML to JSON converter. Handles anchors, aliases, multi-document files and all YAML scalar types. Powered by js-yaml. Runs entirely in your browser — your data never leaves your device.
Three steps — paste your YAML and get valid JSON in seconds.
Paste YAML text directly or upload a .yaml or .yml file. js-yaml parses the full YAML 1.2 spec — including anchors, aliases, multi-document files, block and flow syntax, and all scalar types.
For multi-document YAML files (separated by ---), choose whether to output only the first document or wrap all documents in a JSON array. Toggle between pretty-printed and minified output.
Click Convert and copy the JSON to clipboard or download a .json file. The output is valid JSON ready for any API, database, JavaScript application or data pipeline.
Why YAML and JSON represent the same data differently.
YAML and JSON are both data serialisation formats, but designed for different audiences. YAML is optimised for human readability — it uses indentation instead of braces and brackets, supports comments, and has a richer type system including dates and binary. It is the standard format for configuration files (Docker Compose, Kubernetes, GitHub Actions, Ansible).
JSON is optimised for machine consumption — it is a strict subset of JavaScript object syntax, universally supported by APIs, databases and programming languages without any additional parser. Every JSON document is valid YAML, but not every YAML document is valid JSON.
The main conversion challenges are YAML-only features that have no JSON equivalent: comments (discarded), anchors and aliases (resolved to their values), multi-document files (each document becomes a separate JSON object), and YAML dates (converted to ISO 8601 strings since JSON has no date type).
Common workflows where JSON output is required from YAML input.
Kubernetes manifests and Docker Compose files are YAML. Converting to JSON lets you use them with tools that expect JSON input — kubectl supports JSON, and some CI/CD platforms and policy engines (like OPA/Rego) work natively with JSON.
Many applications accept both YAML and JSON config. Converting your YAML config to JSON is useful when migrating to a stack that prefers JSON, when generating config programmatically, or when validating config against a JSON Schema.
REST APIs, GraphQL variables and most data pipelines accept JSON but not YAML. Converting a YAML data file to JSON lets you pass it directly as an API request body or pipeline input without a server-side YAML parser dependency.
While Python's PyYAML can read YAML natively, converting to JSON first is useful for sharing data with tools that don't have a YAML dependency, for debugging YAML parsing issues, or for loading into pandas with pd.read_json().
What each setting controls in the JSON output.
| Option | Values | What it does |
|---|---|---|
| Multi-document | First only · All as array | YAML files can contain multiple documents separated by ---. First only outputs the first document as a JSON object — the most common case. All as array wraps every document in a JSON array — useful when you need to process all documents programmatically. |
| Formatting | Pretty · Minified | Pretty formats the output with 2-space indentation — human-readable for inspection, documentation and debugging. Minified removes all whitespace — smallest possible payload for API transmission or storage. |
Other free converters you might need next.
YAML parsed in
your browser. No upload.
JSONshift uses js-yaml — the most widely deployed JavaScript YAML parser with 150 million weekly npm downloads, used in ESLint, Webpack, Prettier and thousands of other tools — to parse YAML entirely in your browser. Your data is never transmitted to any server.
The output is valid JSON — anchors resolved, aliases expanded, dates converted to ISO 8601 strings, and comments discarded. The result passes JSON.parse() without errors and works with any JSON consumer.
