Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

JSON to YAML Converter

Paste JSON and get clean YAML for Kubernetes manifests, Docker Compose, GitHub Actions or any config file. Both sides stay editable and in sync.

Mis à jour le
YAML indent
JSON indent
Open file

Both panes are editable — change either side and the other updates instantly.

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : JSON to YAML

  1. Paste JSON into the JSON pane, open a .json file, or click Load sample.
  2. The YAML pane updates instantly. Pick a YAML indent of 2 or 4 spaces and optionally sort keys or quote every string.
  3. Edit the YAML directly if you like — the JSON side updates too.
  4. Click Copy or Download to save data.yaml.

What does a JSON to YAML converter do?

It parses a JSON document and re-serializes the same data as YAML. Because YAML 1.2 is a superset of JSON, every JSON value has an exact YAML equivalent: objects become mappings, arrays become sequences (- item), and strings, numbers, booleans and null stay the same type. The result is typically 20–40% shorter and far easier to read and edit by hand, which is why YAML is the standard for Kubernetes, Docker Compose, GitHub Actions, Ansible and OpenAPI specs.

Example

This JSON:

{
  "service": "api",
  "replicas": 3,
  "ports": [8080, 9090],
  "env": {"LOG_LEVEL": "info"}
}

becomes this YAML:

service: api
replicas: 3
ports:
  - 8080
  - 9090
env:
  LOG_LEVEL: info

How strings are quoted

The converter (powered by the widely used js-yaml library) only adds quotes where they are needed to keep the value a string. Values like "yes", "on", "123", "null" or "2024-01-01" are quoted because an unquoted yes would be read as a boolean by YAML 1.1 parsers (the famous “Norway problem”, where the country code NO turns into false). Strings containing : , # or leading spaces are also quoted. Multi-line strings are written as literal block scalars (|-) so line breaks stay readable. Enable Quote all strings if a downstream tool expects every string quoted.

JSON vs. YAML at a glance

JSONYAML
CommentsNot allowed# comment
StructureBraces and bracketsIndentation
QuotesRequired on keys and stringsUsually optional
Multi-line strings\n escapesBlock scalars | and >
ReuseNoneAnchors & and aliases *
Best forAPIs, data exchangeHuman-edited config

Tips for config files

Indentation in YAML must use spaces, never tabs. Two spaces is the convention for Kubernetes and most CI systems. After converting, you can add comments to explain settings — something JSON cannot hold. To go the other way, use the YAML to JSON converter; to tidy the JSON first, run it through the JSON Formatter.

Aussi recherché comme : json to yml, convert json to yaml, json yaml converter, json2yaml, kubernetes yaml, yaml generator.

Outils complémentaires : JSON to YAML

  • JSON to CSV — Turn a JSON array into a spreadsheet-ready CSV.
  • JSON to TypeScript — Paste a JSON sample — an API response, a config — and get ready-to-use TypeScript interfaces with nested types, optional properties and union types.
  • JSON Schema Validator — Paste a schema and some JSON to see exactly which values break which rule — or generate a starting schema from example data.
  • JSONPath Tester — Type a JSONPath query and instantly see what it selects — with the exact path of each match.

Questions fréquentes

Is YAML a superset of JSON?
Yes, since YAML 1.2 (2009) any valid JSON document is also valid YAML. That is why the conversion is lossless: the data and types are identical, only the syntax changes.
Why are some of my strings quoted in the YAML output?
Strings such as "yes", "off", "0123" or "1.0" would be interpreted as booleans or numbers if left unquoted, so they are quoted to preserve them as strings.
Can I convert JSON to YAML for Kubernetes?
Yes. Paste the JSON output of kubectl get … -o json and you get YAML you can save as a manifest. Remove server-generated fields such as status, uid and resourceVersion before applying it again.
Is my data sent anywhere?
No. The conversion runs in your browser using the open-source js-yaml library; nothing is uploaded.
Puis-je installer JSON to YAML en tant qu’application web et l’utiliser hors ligne ?
Oui. JSON to YAML est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires