YAML ↔ JSON Converter

Convert between YAML and JSON formats instantly. Supports nested objects, arrays, and all scalar types.

Indent:
YAML InputN/A
JSON Output

Output will appear here

Free online YAML to JSON converter: bidirectional format transform

YAML and JSON are both structured data formats, but they serve different contexts. YAML excels in configuration files where human readability matters; JSON excels in APIs and data interchange where strict parsing is required. This converter lets you move freely between the two, handling all common data types and nested structures without any setup.

Whether you're adapting a Kubernetes manifest to a JSON schema validator, converting a package.json for use in a YAML-based CI pipeline, or just exploring the structural equivalence of the two formats, this tool handles the conversion instantly. The indent selector lets you control output formatting, and clear error messages tell you exactly where a parse failure occurred.

Step-by-step guide

  1. 1
    Choose the conversion direction
    Click YAML to JSON or JSON to YAML in the direction toggle to set which format you are converting from.
  2. 2
    Paste your input
    Paste the YAML or JSON you want to convert into the left panel. Use the Sample button to load an example instantly.
  3. 3
    Set the indent size
    Choose 2 or 4 spaces for the output indentation using the Indent toggle. This affects the JSON output formatting and YAML nesting.
  4. 4
    View the converted output
    The right panel shows the converted result in real time. Errors are displayed inline if the input cannot be parsed.
  5. 5
    Copy and use the output
    Click Copy to grab the converted output and paste it into your project, API tool, or config file.

Related Tools

Frequently Asked Questions

Can this tool convert complex nested YAML to JSON?
Yes. The YAML parser handles nested objects, arrays, inline values, multi-line blocks, and mixed structures. Deep nesting is fully supported.
Does it preserve number and boolean types?
Yes. Scalars are type-inferred: true/false become JSON booleans, numeric strings become JSON numbers, and null/~ become JSON null. Quoted strings remain strings.
Is my data uploaded to a server?
No. All conversion logic runs in your browser. Nothing is transmitted externally.
Can I convert JSON back to YAML?
Yes. Switch the direction toggle to JSON to YAML and paste your JSON. The tool generates properly formatted YAML with appropriate quoting and indentation.
Does YAML-to-JSON preserve key order?
The YAML parser processes keys in the order they appear in the source and the JSON serialiser outputs them in the same order. JavaScript's JSON.stringify() preserves insertion order for string keys in modern engines.
What YAML features are not supported?
Advanced YAML features like anchors and aliases (&anchor / *alias), merge keys (<<), multi-line literal and folded block scalars, and YAML directives (%YAML) are not currently supported. These are uncommon in typical config files.
Why would I convert YAML to JSON?
JSON is the universal API format and is required by many tools, databases, and REST clients. Converting YAML config to JSON lets you use it in environments that expect JSON, such as API testing tools, MongoDB, or cloud configuration schemas.
Why would I convert JSON to YAML?
YAML is more human-readable than JSON and is preferred for configuration files because it supports comments and does not require quotes around most strings. Converting API response JSON to YAML is useful for writing config templates or documentation.
How do I convert a Kubernetes YAML file to JSON?
Paste the Kubernetes manifest YAML into the left panel with the direction set to YAML to JSON. The tool converts the full document including nested spec, containers, and env blocks. Copy the JSON output to use with JSON-based tools like kubectl --dry-run or API testing clients that expect JSON payloads.
What is the difference between YAML and JSON for configuration files?
YAML supports comments (lines starting with #), does not require quotes around most string values, and uses indentation instead of brackets. JSON is stricter, has no comment support, but is universally parseable. YAML is preferred for human-edited configs (GitHub Actions, Docker Compose, Kubernetes); JSON is preferred for machine-generated data and API payloads.

AlteredIdea vs alternatives

vs server-side tools: Everything runs in your browser: your data never leaves your device.

vs VS Code extensions: No install needed. Works instantly in any browser.

vs paid tools: Completely free, no account required.