How to Convert YAML to JSON Online
Paste your YAML
Copy the contents of your YAML file or config block and paste it into the YAML Input box. The conversion runs entirely in your browser, so the text you paste stays on your device.
Click Convert to JSON
Press the Convert button. The tool parses the YAML in your browser and writes pretty-printed JSON, indented with two spaces, into the JSON Output box. If the YAML has a syntax problem, the input is highlighted and the parser message tells you what went wrong.
Copy the JSON output
Use the Copy button to place the formatted JSON on your clipboard, then paste it into your editor, API request, or config file. Use Clear to reset both boxes before pasting a new document.
How YAML Structures Map to JSON
This converter loads your YAML into an in-memory value and serializes it as JSON, so every YAML construct is translated to its closest JSON equivalent. The table below shows what to expect for common node types.
| YAML construct | JSON result | Notes |
|---|---|---|
| Mapping (key: value) | Object | Keys become JSON string keys with double quotes. |
| Sequence (- item) | Array | Both block and inline [a, b] sequences convert. |
| Scalars (numbers, true, null) | Native JSON types | Quoted scalars stay strings; bare 42 or true become number and boolean. |
| Anchors and aliases (&a, *a) | Resolved values | References are expanded inline; JSON has no alias syntax. |
| Comments (# ...) | Dropped | JSON has no comment syntax, so comments are not carried over. |
| Multi-line strings (|, >) | JSON string with \n | Folded and literal blocks become a single escaped string value. |
When YAML to JSON Conversion Helps
Feeding APIs
Many REST and GraphQL endpoints accept JSON request bodies only. Author the payload in readable YAML, then convert it here to a clean JSON body you can drop into your client or curl command.
Front-end config
JavaScript and TypeScript projects often import .json directly. Convert a YAML config into JSON so it can be required or fetched without adding a YAML parser dependency.
Inspecting CI and Kubernetes files
Pipeline and manifest files are written in YAML where indentation is easy to misread. Converting to JSON reveals the exact object and array structure your tools actually see.
Validating syntax quickly
If you only need to confirm a YAML snippet parses, paste it here. A successful conversion means the structure is valid; an error message points to the line or token that broke parsing.
Common Problems and Fixes
Invalid YAML error appears
The parser found a syntax issue and shows the message it returned. The most common causes are mixing tabs with spaces for indentation, a missing space after a colon, or inconsistent indent levels. Replace any tabs with spaces and re-check alignment, then convert again.
Comments are missing from the JSON
This is expected. JSON has no comment syntax, so any # comment lines in your YAML are not included in the output. Keep a copy of the original YAML if you need those notes.
Numbers or dates became strings (or the reverse)
YAML decides types by how a value is written. Quoting a value like "42" keeps it a string, while a bare 42 becomes a number. Add or remove quotes in the source to control whether a value lands as a JSON string or a native type.
Output box stays empty
An empty input produces no output, so make sure you pasted text and clicked Convert. If the YAML library failed to load, the status line will say so; check your connection and reload the page. A blank result alongside an error message means parsing failed and needs a fix in the input.