YAML to JSON Converter
Convert YAML to JSON for Kubernetes manifests, CI workflows and config files — with multi-document support and errors that point at the exact line.
How to use this tool
Steps for using the JSON to YAML.
- YAML → JSON is selected. Paste YAML or click Upload file to open a
.yamlor.ymlfile — the JSON appears as you type. - Choose the JSON Indent (2, 4 or Minified) and turn on Sort keys for a stable, diff-friendly order.
- If the input holds several documents separated by
---, choose under Several documents whether to get one JSON array or JSON Lines (one document per line). - Errors point at the exact line and column. Copy or Download the JSON, or use the swap button to turn it back into YAML.
Example
A Kubernetes Service
apiVersion: v1
kind: Service
metadata:
name: web
spec:
ports:
- port: 80
targetPort: 8080{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "web"
},
"spec": {
"ports": [
{
"port": 80,
"targetPort": 8080
}
]
}
}Common use cases
- Feeding Kubernetes manifests or Helm values to tools and APIs that only accept JSON.
- Converting GitHub Actions, GitLab CI or Docker Compose files to inspect them with
jq. - Turning YAML config into JSON for JavaScript or JSON Schema validation.
- Debugging indentation mistakes — the error shows the exact line and column.
How YAML maps to JSON
JSON is a subset of YAML's data model, so every YAML document made of mappings, sequences and scalars has a JSON equivalent: mappings become objects, sequences become arrays, and scalars become strings, numbers, booleans or null. Comments are dropped, because JSON has none.
Unquoted scalars are typed using the YAML 1.2 rules, as Kubernetes, Docker Compose and GitHub Actions expect: true/false are booleans and numbers stay numbers, but yes, no, on and NO are strings — the old YAML 1.1 "Norway problem" doesn't happen. Watch out for version numbers: 1.10 is a number and becomes 1.1; quote it ("1.10") to keep it as text.
A file with several documents separated by --- becomes a JSON array with one item per document, or JSON Lines if you prefer one document per line. Anchors (&name) and aliases (*name) are expanded into full copies, with a limit of 100 aliases to stop "billion laughs" expansion attacks.
Need the other direction? Use the JSON to YAML converter. To check YAML without converting it, use the YAML Validator.
Limitations
- Comments are removed — JSON has no comments.
- Merge keys (
<<: *defaults) are not merged: they appear as a literal"<<"key, following YAML 1.2. - Custom tags such as
!Refin CloudFormation are not resolved. .nanand.infbecomenull, since JSON can't represent them.
Frequently asked questions
Why did my YAML value change type?
Unquoted scalars are typed: 1.10 becomes the number 1.1, null and ~ become null. Quote values that must stay text, such as versions and ZIP codes.
Does yes/no become true/false?
No. Following YAML 1.2, only true and false are booleans; yes, no, on and off stay strings. Older YAML 1.1 tools treated them as booleans.
How are multiple YAML documents converted?
Each document separated by --- becomes one item of a JSON array, or one line of JSON Lines if you choose that under Several documents.
Are my files uploaded?
No. Conversion runs entirely in your browser; the YAML never leaves your device.