YML

YAML to JSON Converter & JSON to YAML

Move configuration data between YAML and JSON with clear validation and local downloads.

Runs locallyNo accountFree
InputMaximum 1 MB
Converted outputRead only

Ready. Input is processed only in this tab.

Important

YAML comments, anchors, aliases and presentation choices cannot be represented in JSON and may be lost during conversion. The parser uses the JSON-compatible YAML schema.

How to use this yaml ↔ json converter

  1. Choose YAML to JSON or JSON to YAML.
  2. Paste the configuration or data document.
  3. Convert, inspect, copy or download the result.

Convert YAML to formatted JSON

Choose YAML to JSON and paste a configuration, manifest or ordinary data document. The converter parses mappings as JSON objects, sequences as arrays, and JSON-compatible scalars as strings, numbers, booleans or null. The result is formatted with two-space JSON indentation so it can be inspected before copying or downloading. A syntax error is reported instead of producing a partial result.

Convert strict JSON to readable YAML

Choose JSON to YAML when an API response, fixture or configuration needs a more concise human-readable representation. The JSON input must use double-quoted strings and keys, without comments or trailing commas. Objects, arrays and primitive JSON values are converted. Output uses spaces for indentation and avoids creating YAML aliases for repeated JavaScript references.

Nested objects, arrays and scalar types

Both formats can represent nested mappings, ordered arrays, strings, finite numbers, booleans and null. YAML also has schemas that can interpret additional types. This converter deliberately uses the JSON-compatible YAML schema to keep the result predictable: for example, a date-looking value remains a string instead of silently becoming a browser Date object. Quote a YAML value when its exact string type matters.

Worked configuration example

A YAML service with port: 8080, enabled: true and a two-item feature list becomes a JSON object whose port is a number, enabled is a boolean and features is an array. Converting that JSON back produces equivalent data, although the exact spacing and quoting may differ from the original YAML.

Anchors, aliases and multiple YAML documents

YAML anchors can reuse one value in several places. The parser resolves those aliases before JSON output because JSON has no anchor syntax. A circular alias cannot become JSON and is rejected with a clear error. When the YAML input contains several documents separated by ---, the converter returns one JSON array containing each document in order. This is a conversion rule, so a single YAML document whose root is already an array is indistinguishable by shape unless you retain the source.

What conversion cannot preserve

JSON describes data but has no comments, anchors, tags or YAML presentation style. Comments are therefore lost, aliases are expanded and quoting or block-scalar choices may change. JSON also cannot represent non-finite numbers such as Infinity or arbitrary tagged values. Check the result before replacing a deployment, CI or infrastructure configuration. This utility validates syntax and converts values; it does not validate a Kubernetes resource, Docker Compose file, workflow or application-specific schema.

Privacy, limits and safe use

The parser and download logic run locally in the current browser tab. Code Compass does not submit the pasted document to its server. Input is limited to one million characters to protect browser responsiveness. Local processing does not make a shared or compromised device safe, so remove passwords, tokens and production credentials whenever possible.

Related structured-data tools

Use the JSON Formatter for strict JSON validation and minification, JSON Diff to compare converted structures, or the JSON and CSV Converter for flat table-shaped records.

Frequently asked questions

Does YAML to JSON keep comments?

No. JSON has no comment syntax, so comments and source formatting cannot be represented.

Can I convert multiple YAML documents?

Yes. Documents separated by YAML markers are returned as an ordered JSON array.

Are anchors supported?

Non-circular aliases are resolved into ordinary values. Circular alias graphs are rejected because JSON cannot represent them.

Related developer tools