Skip to content

Convert JSON Data to YAML Format

Converts JSON into YAML block style using the yaml library: objects become indented keys, arrays become dash lists, and key order is kept. Strings that YAML would read as another type, such as "8080", are quoted.

Turning a JSON payload into a values file or config snippet for Kubernetes, Docker Compose or CI.

When to use it

  • Turning a JSON payload into a values file or config snippet for Kubernetes, Docker Compose or CI.
  • Reading a deeply nested JSON document as indented YAML instead of brackets.

How to use

  1. Paste strict JSON into the left editor or load a .json file.
  2. Check the YAML on the right; quoted values are strings that would otherwise change type.
  3. Copy the YAML into your config file and check it against the tool that will read it.

JSON input

{"service":"billing-api","replicas":2,"env":{"LOG_LEVEL":"info","PORT":"8080"},"ports":[80,443],"note":null}

YAML

service: billing-api
replicas: 2
env:
  LOG_LEVEL: info
  PORT: "8080"
ports:
  - 80
  - 443
note: null

Details and limitations

Conversion runs in the browser. There are no settings for indent width, flow style or quote style.

Input must be strict JSON: comments, trailing commas and unquoted keys cause an error. Clean them first with JSON Format.

null stays null, empty arrays become [] and empty objects become {}. Strings containing newlines are written as |- block scalars.

FAQ

Will "001" or "8080" stay strings?

Yes. When a string looks like a number or boolean, it is written in quotes, e.g. PORT: "8080". Leading zeros are lost only if the JSON already held a number.

Can I convert a JSON array at the root?

Yes. A root array becomes a top-level YAML sequence, with each object written as a dash item.

Does it add YAML comments or anchors?

No. JSON has no comments and the converter does not create anchors or aliases; repeated objects are written out in full.

Specifications and references