Developer tools

JSON to YAML Converter

JSON to YAML Converter

Convert JSON to clean, correctly quoted YAML.

About this tool

About JSON to YAML Converter

Turn a JSON object into YAML you can drop into a Kubernetes manifest, a Helm values file, docker-compose, a GitHub Actions workflow or an OpenAPI spec. Objects become indented maps, arrays become dash lists, and null, true, false and numbers keep their types. The converter takes care of the details that trip people up: strings that YAML 1.1 parsers would misread as booleans or numbers, such as yes, no, on, off, NO (the country code), 1e3 or 012, are wrapped in quotes so PyYAML, Ansible, Go and JavaScript all read the same value. Long strings stay on one line instead of being folded, so diffs stay clean. If the JSON is invalid you get the line and column of the problem, for example a trailing comma. Choose 2 or 4 spaces, and use Swap to convert the YAML back to JSON to double-check a round trip. Everything happens in your browser and nothing is uploaded.

Built and maintained by Abhi JainUpdated

How to Convert JSON to YAML

  1. 1

    Paste JSON

    Paste JSON into the left pane, open a .json file, or click Sample.

  2. 2

    Choose the indentation

    Pick 2 spaces or 4 spaces. Fix any error shown with its line and column.

  3. 3

    Copy or download

    Copy the YAML or download it as a .yaml file. Click Swap to convert it back.

JSON to YAML Converter: questions and answers

Why are some values quoted in the YAML?

Older YAML 1.1 parsers read yes, no, on, off, y and n as booleans, and values like 012 or 1e3 as numbers. Quoting them keeps them as strings, exactly as they were in your JSON.

Is the YAML output valid for Kubernetes?

Yes. The output is standard block-style YAML with 2-space indentation by default, which kubectl, Helm and other Kubernetes tools accept.

Can YAML represent everything JSON can?

Yes. YAML 1.2 is a superset of JSON, so every JSON value has a YAML equivalent. The JSON is read with the browser's JSON parser, though, so integers above 9007199254740991 lose precision, a repeated key keeps only its last value, and 1.50 is written as 1.5. Quote such values in the JSON if they must stay exact.

Is my JSON uploaded?

No. The conversion runs in your browser.

More YAML to JSON Converter presets