toolgarden.xyz
中文

JSON ↔ YAML

Free online JSON to YAML and YAML to JSON converter

JSON

YAML

About this tool

JSON and YAML can both represent objects, arrays, strings, numbers, booleans, and null values, but their syntax serves different readers. YAML uses indentation and list markers for human-maintained configuration; JSON uses explicit brackets and quotes for strict program interchange.

Conversion preserves the data structure, not comments, blank lines, anchor spelling, or scalar style. YAML text that resembles a date, number, or boolean can also be assigned a different type, so important fields should be checked after migration.

How to use it

  1. Choose the direction

    Select JSON to YAML or YAML to JSON explicitly; the tool does not guess from a file extension.

  2. Paste and parse the document

    Enter the complete input. Parse errors usually point near a bad indentation level, colon, or quote.

  3. Check types and copy

    Review dates, leading zeroes, booleans, and nulls before copying the converted document.

Input and output example

One configuration in both notations. YAML swaps brackets for indentation and can carry comments.

JSON
{
  "service": "api",
  "replicas": 3,
  "env": { "LOG_LEVEL": "debug" }
}
YAML
service: api
replicas: 3
env:
  LOG_LEVEL: debug

Supported range and limits

Directions
JSON to YAML and YAML to JSON
YAML-only features
Comments, anchors and references, multi-document streams (---); all lost when converting to JSON
Indentation sensitive
YAML expresses nesting through indentation, and mixing tabs with spaces is the most common parse failure
Easy traps
Unquoted yes / no / on / off parse as booleans in YAML, and `1.0` becomes a number
Leading zeros
Postcodes and phone numbers starting with 0 must be quoted, or they are read as numbers and lose the zero
Typical use
Moving between service config, Kubernetes manifests, CI pipeline definitions and API data

When you would use it

  • Maintaining deployment configuration

    Turn generated JSON into readable YAML for CI, container orchestration, or static-site configuration.

  • Calling a JSON-only API

    Convert an existing YAML configuration to strict JSON for an API, validator, or frontend application.

  • Turning an API response into a readable config draft

    JSON from an endpoint becomes YAML you can annotate field by field, which then serves as internal documentation.

What to know before you start

  • The result is an equivalent data structure, not a source-format clone. Comments, blank lines, and layout choices may disappear.
  • YAML hierarchy uses spaces. Tab indentation commonly causes parse failures, so keep indentation consistent.
  • Anchors and aliases are expanded into ordinary data. Cyclic references cannot be represented in strict JSON.

Related concepts

scalar
A single YAML value that cannot be divided further, such as a string, number, boolean, or null.
anchor and alias
YAML syntax for reusing data with & and *. JSON has no equivalent source notation.

Frequently asked questions

Can it convert both JSON to YAML and YAML to JSON?
Yes. It supports both directions; paste either format and the other is generated instantly.
Does converting upload my config files?
No. Conversion runs locally in the browser, so sensitive Kubernetes or docker-compose configs never leave your machine.
What is this useful for?
It is handy for switching between API data (JSON) and CI / cloud-native config (YAML), or turning an API response into readable YAML.
Where did my comments go after converting to JSON?
Strict JSON has no comment syntax and nowhere to keep them. That is a format limit, not the tool dropping content; keep the original YAML and use the conversion only where JSON is required.
Why did no and off become false?
YAML parses unquoted yes / no / on / off as booleans. If they were meant as strings; NO as the country code for Norway, say; they have to be quoted. The same applies to postcodes starting with 0, which lose the zero if left unquoted.