Pulsars

YAML to JSON Converter — Parse YAML to Structured JSON

YAML3 lines
JSON5 lines

YAML (YAML Ain't Markup Language) is a human-readable data serialization format widely used for configuration files in Docker Compose, Kubernetes manifests, Ansible playbooks, GitHub Actions workflows, and CI/CD pipelines. JSON is its machine-readable counterpart — every valid JSON document is also valid YAML, but YAML adds features like comments, multi-line strings, and anchors that JSON lacks.

Why convert YAML to JSON?

YAML-to-JSON conversion is common when validating configuration files (JSON has stricter parsing), when APIs require JSON input, or when programmatically generating configs from YAML templates. JSON is also easier to manipulate in JavaScript/TypeScript and has broader tooling support for validation and schema checking.

Frequently Asked Questions

Why convert YAML to JSON?

+

Many APIs, tools, and programming languages expect JSON input. If your config files are in YAML (Kubernetes, Docker Compose, GitHub Actions), converting to JSON lets you use them programmatically, pass them to REST APIs, or import them into applications that only accept JSON.

Does this handle YAML anchors and aliases?

+

Yes. The converter uses the js-yaml library which fully supports YAML anchors (&), aliases (*), and merge keys (<<). These are resolved to their actual values in the JSON output — anchors become duplicated data since JSON has no equivalent construct.

What about YAML multi-line strings?

+

Multi-line strings using block scalars (| for literal, > for folded) are fully supported. They become regular JSON strings with appropriate newline handling. Literal blocks preserve line breaks, folded blocks collapse them to spaces.

Are YAML comments preserved in JSON?

+

No. JSON does not support comments, so YAML comments (lines starting with #) are stripped during conversion. If you convert back to YAML, the comments will be lost. This is an inherent limitation of JSON, not our tool.

Is this safe for Kubernetes manifests?

+

Yes, all conversion runs locally in your browser. No data is sent to any server. You can safely convert Kubernetes secrets, ConfigMaps, and any other sensitive YAML files. For multi-document YAML (separated by ---), paste each document separately.