JSON to YAML Converter

Paste JSON, get YAML you can commit. Nesting is preserved rather than flattened, values a YAML reader would misinterpret come back quoted, and no anchors are invented. Nothing is uploaded.

Want to edit the data before writing it out? Open the app

Where the JSON usually comes from

This direction is mostly about authorship. JSON is what a machine handed you; YAML is what a human maintains from now on. The common starting points:

  • Cluster output you want to keep. kubectl get deploy -o json gives the live object. YAML is the first step to checking it in.
  • Helm values. Chart defaults and script-assembled values tend to be JSON before anyone writes a values.yaml that people edit.
  • Moving between CI systems. One system's API exports pipelines as JSON; the one you are migrating to reads YAML from the repository root.
  • Config a service already emits. Reading a tool's effective configuration as YAML is how you compare it against the file you thought you deployed.

Worked example: a values file with four traps in it

A short chunk of Helm values, as a script produced it. Watch the last block: a leading zero, a setting whose value is the word no, and a version with a trailing zero.

{
  "replicaCount": 3,
  "image": { "repository": "registry.example.com/billing-api", "tag": "2.4.1", "pullPolicy": "IfNotPresent" },
  "ingress": { "enabled": true, "hosts": ["billing.example.com"], "tls": [] },
  "resources": { "requests": { "cpu": "250m", "memory": "512Mi" } },
  "config": { "LOG_LEVEL": "info", "REGION_CODE": "01730", "CACHE_ENABLED": "no", "VERSION": "1.10" }
}

The YAML, exactly as it comes out:

replicaCount: 3
image:
  repository: registry.example.com/billing-api
  tag: 2.4.1
  pullPolicy: IfNotPresent
ingress:
  enabled: true
  hosts:
    - billing.example.com
  tls: []
resources:
  requests:
    cpu: 250m
    memory: 512Mi
config:
  LOG_LEVEL: info
  REGION_CODE: '01730'
  CACHE_ENABLED: 'no'
  VERSION: '1.10'

Three values picked up quotes and the rest did not. That is the difference between a file that survives a round trip and one that does not. Left bare, REGION_CODE: 01730 loads back as 1730, CACHE_ENABLED: no becomes a boolean in any YAML 1.1 reader, and VERSION: 1.10 becomes 1.1, a different version. tag: 2.4.1 stays bare, because nothing could read it as a number.

The empty list survives as tls: [] rather than becoming null. Charts often check whether a key is present before checking whether it is empty, so the difference is load bearing.

The Norway problem, and why quoting is the whole job

The most famous YAML bug is a country list. Norway's ISO code is NO, and in YAML 1.1 an unquoted no is the boolean false, so a config generated without quoting stops listing Norway. The same surprise covers yes, on, off and y.

YAML 1.2 narrowed booleans to true and false, which helps only if every reader downstream is on 1.2, and you have no idea which library opens the file next. So the writer quotes defensively: any string some reader might resolve as a boolean, a number or null comes out quoted, and everything else stays bare so the file still reads like YAML. The values are already unambiguous strings in your JSON; the whole risk sits in the writing, and it surfaces later, on somebody else's machine.

Nesting is kept, and nothing is invented

  • No flattening. A CSV converter turns {"user":{"name":"Ada"}} into a user.name column because columns are all a spreadsheet has. YAML holds nesting natively.
  • No anchors. Repeated blocks are written in full rather than collapsed into &ref_0 and *ref_0, which makes a diff unreadable.
  • Two-space indentation, lists indented under their key. The style Kubernetes and Helm files use, so the output drops into a repository without a linter complaining.
  • Multi-line strings become block scalars. A string with newlines is written with |- and real line breaks, not one long line full of backslash-n. Past about a hundred characters, a single-line value folds with >- instead.
  • Key order is preserved. Keys come out in the order the JSON listed them, not alphabetised, so converting twice gives the same file.

Gotchas worth knowing

  • JSON Lines input is detected, not configured. No toggle to get wrong.
  • Oversized numbers are already broken on arrival. A number too long for JavaScript to hold exactly is rounded during parsing, so you get a warning rather than a fix.
  • Almost-JSON is read, and says so. Single-quoted strings, unquoted keys, trailing commas, Python's True and None, comments and smart quotes are all forgiven, with a note naming exactly what was fixed. Input that is broken beyond that is refused with the line, the column and a caret pointing at the spot.
  • Empty containers are preserved. {}, [] and null each come out as themselves.
  • There are no options here, on purpose. Indentation, quoting and line width are one house style, because each such setting is a way to produce a file that fails somewhere else.
  • Files up to 100 MB, no daily quota. The download keeps your filename, with a .yaml extension.

Frequently Asked Questions

Does it flatten nested objects the way a CSV converter would?

No, and that is deliberate. A CSV converter turns a nested object into a user.name column because a spreadsheet has no other option. YAML keeps nesting natively, so it is written as indented blocks and stays that way.

Why are some values in single quotes and others bare?

Quotes are added exactly where a YAML reader would otherwise change the value. "no" is written 'no' because unquoted it loads back as false, "01730" so it is not read as 1730, and "1.10" so it does not become 1.1.

My file is JSON Lines, one object per line. Will it work?

Yes. A file holding one JSON value per line is detected without a setting, converted into a YAML sequence with one entry per line, and flagged with a note. A malformed line is named, for example "Line 3 is not valid JSON".

Does the output use anchors for repeated blocks?

No. If the same block appears twice, it is written twice in full. Anchors are a way of writing YAML by hand, and machine-named anchors like &ref_0 are harder to review than a slightly longer file.

What happens to a very long ID number?

You get a warning, because the damage happened before the conversion. A JSON number too long for JavaScript to hold exactly is already rounded during parsing, so 12345678901234567890 comes out as 12345678901234567000. Quote long identifiers in the source.

Is anything uploaded, and how large a file can it take?

Nothing is uploaded. The conversion is JavaScript running in your tab, with no endpoint behind the page and nothing kept between visits. Files up to 100 MB, with no daily quota. Past that the widget offers the full editor.

Convert your JSON to YAML

No sign-up, no upload, no row cap. Nesting kept, risky values quoted, copy the result or download the .yaml.

Back to the converter