Curious why YAML keeps surprising people (the Norway problem, octals, indentation drift)? See JSON vs YAML vs XML.
What's supported
- Block-style mappings and sequences with indentation
- Scalars: strings (plain, single-quoted, double-quoted), numbers, booleans, null (
null,~,yes/no,on/off) - Flow style
[1, 2, 3]and{a: 1} - Comments (
#) and blank lines
Not supported (yet)
- Anchors
&and aliases* - Tags
!!stretc. - Block scalars
|and>(we treat them as plain strings) - Multiple documents separated by
---
Convert YAML configs to JSON for APIs
YAML rules configuration files; JSON rules wire formats. Convert your docker-compose.yml, Kubernetes manifest, GitHub Actions workflow, or Ansible playbook into JSON when you need to feed it to a JSON-only API, a templating engine, or a JSON Schema validator. Pair the output with the JSON Schema validator to enforce shape, or the JSON formatter to pretty-print.
FAQ
Is this safe to use on Kubernetes manifests?
kubectl get's built-in -o json output or use yq locally.How do I convert YAML to JSON online without uploading?
Why are some YAML strings becoming booleans?
yes, no, on, off, and true/false are parsed as booleans by YAML 1.1 semantics. Quote them to keep them as strings.