Free YAML to JSON Converter
Convert YAML to JSON and JSON to YAML in both directions. Paste in either format and get the converted output instantly — no server upload required.
Output will appear here…Common uses
- Convert YAML to JSON for Kubernetes ManifestsConvert Kubernetes YAML to JSON (or back) for tooling, validation scripts, or applying via the API directly.
- Docker Compose YAML / JSON ConversionConvert docker-compose.yml to JSON for inspection, or back to YAML after programmatic edits.
- CI/CD Pipeline Config ConversionConvert GitHub Actions, GitLab CI, CircleCI, and other pipeline configs between YAML and JSON formats.
- App Configuration File ConversionConvert app config files between YAML and JSON — useful when switching frameworks or sharing configs across tools.
- OpenAPI / Swagger Spec ConversionConvert OpenAPI 3.x or Swagger 2.0 API specifications between YAML and JSON. Both formats are valid and interchangeable.
How It Works
Both directions of conversion — YAML to JSON and JSON to YAML — run entirely in your browser using a hand-written parser and emitter built into the page, with no third-party YAML library and no server involved. The logic lives in a single TypeScript module (lib/yamljson.ts) that handles mappings, sequences, scalars, quoted strings, and inline comment stripping.
- 1Input is preprocessed line by lineFor YAML input, the parser splits the text into lines, strips inline comments (tracking quote state to avoid stripping # inside strings), measures indentation depth, and discards blank lines — building a structured list of tokens before any parsing begins.
- 2A recursive descent parser builds the data treeThe parser walks the token list using indentation level to determine structure. It recognises sequence items (- value), mapping keys (key: value), and nested blocks. Scalars go through a typed coercion step that handles null, booleans, integers (rejecting leading-zero values like 007 to avoid silent data corruption), and floats — with an optional mode that keeps YAML 1.1 barewords like yes, no, on, and off as strings rather than converting them to booleans.
- 3Unsupported YAML features are flagged, not silently droppedBefore emitting output, the tool scans for anchors (&name), aliases (*name), merge keys (<<:), block scalars (| and >), multi-document markers (---), and duplicate mapping keys. Any of these triggers a visible warning rather than producing subtly wrong JSON.
- 4JSON is serialised or YAML is emitted, then made availableFor YAML→JSON, the parsed value is passed to JSON.stringify with your chosen indentation (2 spaces, 4 spaces, tab, or minified). For JSON→YAML, a custom emitter walks the parsed JavaScript value and produces indented YAML, quoting string scalars only when necessary (e.g., values that contain :, #, or look like reserved words). Output appears instantly as you type and can be copied or downloaded.
Related Tools
JSON to XML Converter
Convert JSON to XML and XML to JSON, both directions, with attributes and arrays preserved. Runs entirely in your browser — nothing is uploaded.
CSV to JSON
Convert CSV (or TSV) into JSON — array of objects or arrays — with a proper RFC 4180 parser, delimiter auto-detection, and type conversion. Runs in your browser.
JWT Decoder
Decode and inspect any JSON Web Token. View header, payload, expiration, and standard claims. Everything runs locally in your browser — tokens never leave your device.