Skip to content
yutils
Example

Input (YAML)

name: yutils
version: 0.1.0
private: true
tools:
  - base64
  - jwt-decode
  - regex-tester

Output (JSON)

{
  "name": "yutils",
  "version": "0.1.0",
  "private": true,
  "tools": [
    "base64",
    "jwt-decode",
    "regex-tester"
  ]
}

Note

Comments, multi-line strings, and anchors (`&name` / `*name`) are handled. JSON has no comment syntax, so comments drop during conversion.

Usage / FAQ

When to use

  • Convert Kubernetes / GitHub Actions / Docker Compose YAML configs to JSON for API calls
  • Convert JSON API responses to YAML for human-friendly reading
  • Locate YAML indentation errors fast (parser errors point to the line)
  • Spot tab vs space and trailing-space pitfalls
  • Strip comments deliberately by round-tripping YAML → JSON

FAQ

Q.How are comments handled?
A.YAML → JSON drops comments (JSON spec has no comment syntax). JSON → YAML produces no comments either; original YAML comments cannot be recovered.
Q.Why does my YAML fail to parse?
A.Most common causes: mixed tabs/spaces, missing quotes, missing space after `:`. Check the line number in the error message first.
Q.Are YAML anchors supported?
A.Yes — `&base` / `*base` references are expanded inline in the JSON output. Self-referential cycles are not supported.
Fun facts
  • YAML was created in 2001 by Clark Evans, Ingy döt Net, and Oren Ben-Kiki. The name started as 'Yet Another Markup Language,' then was retrofitted as the recursive acronym 'YAML Ain't Markup Language' — to stress that it's a data serialization format, not markup.

    YAML — Official site
  • The famous 'Norway problem' — YAML 1.1 interprets `country: NO` as the boolean *false* (NO/no/false/off all coerce to booleans). Norway's country code flips into a truth value, with disastrous consequences. Fixed in YAML 1.2, but many libraries still default to 1.1.

    StrictYAML — Norway problem
  • YAML 1.2 (2009) is a strict superset of JSON — every JSON document is also valid YAML. That's why tools like yq can process either, and why systems that prefer YAML (like Kubernetes) accept raw JSON without trouble.

    YAML 1.2.2 spec