YAML to JSON converter
Kubernetes manifests, GitHub Actions, and docker-compose files are YAML; some APIs and JavaScript configs want JSON. Convert between formats locally — handy when lint tools accept only JSON or when embedding config in package.json scripts.
Input
How to convert YAML to JSON
1. Paste YAML into the editor.
2. Run convert — syntax errors show line hints.
3. Review JSON output structure.
4. Copy JSON for API or validator.
Conversion examples
docker-compose snippet
services.web.environment map becomes nested JSON object for mock server.
GitHub Actions matrix
strategy.matrix YAML block becomes JSON for documentation generator.
OpenAPI YAML
Partial spec converted to JSON for Swagger UI paste test.
When YAML to JSON
• When tooling accepts JSON only (some schema validators).
• When JavaScript code needs parsed object from YAML source.
• When debugging YAML by viewing JSON equivalent structure.
When to keep YAML
• When human editability and comments matter — YAML supports # comments JSON lacks.
• When anchors and aliases (&ref, *ref) are used — conversion may expand unexpectedly.
• When deploying to K8s — cluster expects YAML usually.
Norway problem
Unquoted NO in YAML becomes false in some parsers. Quote country codes and version strings like "1.0" to avoid boolean/ float surprises in JSON.
K8s round trip
kubectl accepts JSON too — converting for jq processing then back is OK if you validate before apply.
Secrets in YAML
Never paste production kubeconfig with tokens into untrusted online converters — this tool runs locally but clipboard history may retain secrets.
Frequently asked questions
Comments in YAML?
Stripped on JSON output — comments do not survive conversion.
Tabs in YAML?
YAML forbids tabs for indentation — fix spaces first.
Multi-document YAML?
--- separated docs may need splitting manually.
Type coercion?
YAML 1.1 treats yes/no as boolean — JSON true/false results; beware unquoted country codes like NO for Norway.
Local?
Yes.
JSON back to YAML?
Use a JSON-to-YAML tool if available; manual rewrite for comments.