.json file.YAML (YAML Ain't Markup Language) is the human-friendly configuration format used in Kubernetes, Docker Compose, GitHub Actions, Ansible, and most CI/CD systems. JSON is the machine-friendly API exchange format. Converting between them is a constant need — especially when debugging a YAML config by examining its parsed structure, or when an API requires JSON but your workflow generates YAML.
YAML is a superset of JSON — every valid JSON document is valid YAML. YAML adds: comments (#), human-readable block sequences and mappings (no braces or brackets required), multi-line strings, and anchors/aliases for DRY configuration (&anchor / *alias). JSON is stricter: no comments, no trailing commas, double-quoted strings only. When converting YAML to JSON, comments are discarded and anchor/alias references are resolved.
Yes. Anchors (&name) mark a node for reuse; aliases (*name) reference it. When converting to JSON, all aliases are replaced with the referenced content inline — JSON has no equivalent shorthand.
YAML 1.1 treated "yes", "no", "on", "off", "true", "false" as Booleans. YAML 1.2 restricted this to only "true" and "false". Many YAML parsers still use 1.1 semantics. If your YAML has "yes" as a string value, quote it explicitly: "yes".
Literal block scalars (|) preserve newlines as-is. Folded scalars (>) join lines with a single space (replacing the newline). Both become JSON string values with appropriate newline characters in the output.
Yes — YAML strings, numbers, booleans, null, sequences (arrays), and mappings (objects) all map directly to JSON equivalents. YAML also supports ordered maps and binary data types that have no JSON equivalent and are handled as strings in the output.
See also JSON to YAML, YAML to CSV, YAML to XML, and the JSON Formatter.