Convert on the command line
yq -o=json file.yaml # YAML โ JSON (mikefarah/yq)
yq -P file.json # JSON โ YAML
kubectl get deploy web -o json # ask kubectl for JSON directly
YAML gotchas that break deployments
- The Norway problem: in YAML 1.1, unquoted
NO, yes, on become booleans. Quote country codes and flags.
- Tabs: YAML indentation must use spaces.
- Octal-looking numbers:
mode: 0755 may be parsed as 493. Quote file modes and version numbers like "1.10".
- Multiple documents:
--- separates documents; this converter handles one document at a time.