JSON to YAML Converter - Convert Both Ways Online

Tools / Converters / JSON to YAML Converter

Convert JSON to YAML and back

Converting between JSON and YAML

JSON and YAML describe the same data — maps, lists, strings, numbers, booleans and null — in two syntaxes. JSON is what APIs and package files speak; YAML is what configuration files for Docker, Kubernetes, GitHub Actions and CI pipelines are written in. This converter translates one to the other instantly and takes care of the details that trip people up: quoting, indentation and the odd words YAML treats as booleans.

Steps

  1. 1 Choose the direction and paste your document into the top box. The result appears below as you type.
  2. 2 Set the indent width — 2 spaces is the convention in YAML and in most JSON style guides.
  3. 3 Copy the result, download it as a file, or use the output as new input to check that it round-trips.

What changes between the two formats

YAML drops the braces, brackets and most quotes and uses indentation for structure, so a 40-line JSON object becomes a 25-line YAML document. Keys stay in the same order. Lists become dash items; nested objects become indented blocks; an empty object or list stays written as {} or []. Going the other way, YAML comments are lost because JSON has no comments.

Why some strings come out quoted

In YAML an unquoted yes, no, on, off, true or null is read as a boolean or null, and 123 or 1.0 as a number. A string that looks like one of these must be quoted or it changes type on the way back — the classic example is the country code NO becoming false. The converter quotes exactly those strings, plus anything with leading or trailing spaces, a colon followed by a space, or a leading special character, and leaves everything else plain for readability.

Multi-line strings

A string containing line breaks is written as a YAML block scalar: a pipe on the key line and the text indented underneath, with a minus sign when the string has no trailing newline. That is the form you see in Kubernetes manifests and CI files, and it reads back to exactly the same string.

Indentation and compatibility

The converter writes YAML 1.2, which every modern parser reads — PyYAML, js-yaml, Go yaml, Ruby Psych. Nested keys are indented by the width you choose; the keys of an object inside a list sit two spaces after the dash regardless, as the specification requires. Tabs are never used.

JSON and YAML conversion - frequently asked questions

From JSON to YAML, yes: every value and the key order survive, and converting back gives the same JSON. From YAML to JSON, comments and anchors are resolved away because JSON cannot express them.
New
Cooking Converter Convert cups, tablespoons, teaspoons and fluid ounces to grams and ounces for 40 common ingredients — flour, sugar, butter, honey, rice and more — using each ingredient's real density. Runs in your browser.
Popular Today
Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.

Related Converters

Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.
PDF to Word Convert PDF to Word for free: upload a PDF and download an editable DOCX in seconds - no registration, no watermark and nothing to install.
Image Converter Free image converter: pick PNG, JPG, WebP, GIF or BMP and convert any picture in your browser - your photos are never uploaded to a server.
WebP to PNG Convert WebP to PNG for free: transparency is preserved and the image never leaves your device - the whole conversion runs in your browser.
PNG to JPG Convert PNG to JPG for free: pick the quality and a background colour for transparent areas, all in your browser with no upload.

Other Tools You May Like

MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.
Base64 Encoder & Decoder Free Base64 encoder and decoder: convert text or files to Base64 and back, entirely in your browser - nothing is uploaded to a server.
Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.
Character Counter Free character counter: count characters with and without spaces, plus words and lines, and check SEO limits for titles and meta descriptions.
Keyword Density Checker Free keyword density checker: paste text or a URL to see how often each word and phrase appears, with percentages for one, two and three-word terms.