JSONConverter
โ† Back to the tools
F

JSON vs YAML for Config Files: Which Should You Actually Ship?

YAML is a superset of JSON with better ergonomics for humans, and that is exactly the problem: the features that make it pleasant to write are the ones that make it surprising to read. JSON is a strict subset every language parses without a library. The answer depends on who edits the file.

What YAML gives you that JSON does not

Comments, multi-line strings, anchors and merge keys, and far less punctuation. For a file a human edits by hand, that ergonomics is worth a lot. It is why Kubernetes, GitHub Actions and most infrastructure tools chose it.

What that costs

YAML has implicit typing traps: unquoted no becomes a boolean false in YAML 1.1, 1.0 can become a float, and a version like 1.20 stops being a string. Indentation is semantic, so a tab is an error that reads like a syntax problem. JSON has none of these.

The practical rule

If the file is written by a program, emit JSON: unambiguous, and every consumer parses it. Use the JSON to YAML converter when you need both from one source. If a person edits it regularly, YAML earns its complexity, but quote anything that could be coerced and validate it in CI. Keeping both is fine: author in YAML, generate JSON.

Convert your data free