JSON to YAML
Convert JSON to YAML instantly. Paste any valid JSON object or array and get clean, spec-correct YAML output with indent and key sorting options — free, browser-based.
What JSON to YAML Does
It takes a valid JSON string and outputs a YAML document beginning with ---, with objects serialized as block mappings, arrays as block sequences, and scalar values mapped to their correct YAML equivalents — including quoted strings where required, block scalars for multiline strings, and .inf, -.inf, .nan for special number values.
Who Uses This Tool
JSON to YAML is built for DevOps engineers writing Kubernetes manifests or Helm values files, backend developers working with YAML-based application configs, infrastructure-as-code practitioners migrating JSON configs to YAML, CI/CD pipeline engineers, developers authoring Docker Compose or GitHub Actions files. Whether you are processing data as part of an automated pipeline or need a quick one-off conversion in your browser, the tool requires no installation and no account — paste your input and get your result in seconds.
Primary Use Case
Converting a JSON config object or API response into a YAML file ready to commit directly into a Kubernetes manifest or CI/CD pipeline configuration.
The Problem It Solves
Rewriting JSON as YAML by hand means manually removing curly braces and brackets, converting every quoted key, applying correct indentation at every nesting level, and knowing which string values require quoting to avoid YAML type coercion — a slow, error-prone process where a single indentation mistake or unquoted reserved word silently produces invalid or mistyped output. This tool removes the entire manual process: paste JSON, get spec-correct YAML immediately with no risk of indentation drift or scalar type errors.
Example
{"name":"api-server","replicas":3,"enabled":true,"tags":["web","prod"]}
name: api-server replicas: 3 enabled: true tags: web prod
What to Do With the Output
They paste the YAML output directly into a Kubernetes manifest, Helm values file, GitHub Actions workflow, Docker Compose file, or any YAML-based application configuration that previously existed as JSON.
Common Mistakes to Avoid
String values that match YAML reserved words — true, false, null, yes, no, on, off — are automatically quoted in the output to preserve their string type; if you see unexpected quotes, this is intentional and correct. Hex and octal number representations are not valid JSON and will cause a parse error before conversion begins. Circular references in programmatically constructed JSON objects cannot be serialized and will throw an error. Floating point special values like Infinity and NaN are not valid JSON either — they must be represented as strings in the input if you need them to appear in the YAML output
How It Works
The tool parses the input with JSON.parse() to produce a native JavaScript value tree. A custom recursive serializer then walks that tree: plain objects become YAML block mappings with keys quoted only when they conflict with YAML reserved words, number-like patterns, or characters with special meaning in YAML. Strings containing newlines are serialized using block scalar style (| or |- depending on trailing newline). Arrays become block sequences. Booleans, nulls, integers, and floats map directly to their YAML scalar equivalents. If Sort Keys is enabled, deepSortKeys() alphabetically reorders all object keys before serialization. The final output is prefixed with --- for spec-compliant YAML document structure.
Pro Tip
Enable Sort Keys before converting large or frequently updated config files — normalized key order makes diffs between two versions of the same config significantly cleaner in version control and far easier to review in pull requests.
Also Known As
JSON to YAML is also commonly referred to as json to yaml, json to yml, convert json to yaml, json to yaml online free, json yaml formatter, json to yaml transform, kubernetes json to yaml, json to yaml converter tool, json to yaml parser. All of these terms describe the same conversion — no matter what you call it, this tool handles it.