YAML to JSON converter
Convert YAML configs to JSON
js-yaml reads your document under its default schema, which is the safe one: ordinary scalars, sequences and mappings are accepted while custom application tags are rejected rather than executed. Anchors, aliases and merge keys are resolved as the document loads, so a config built out of shared blocks arrives fully expanded. Comments have no representation in JSON and are dropped. The resulting value is printed with two-space indentation. One document per conversion: a stream separated by three dashes is refused rather than silently truncated.
Key facts about YAML to JSON converter
| Loader | js-yaml 4.1 load with the default safe schema, so tags such as a JavaScript function type are refused. |
|---|---|
| Specification | YAML 1.2 core schema. Only true and false are booleans, so yes, no, on and off stay strings. |
| Anchors and aliases | Resolved and expanded inline, so a block reused three times appears three times in the JSON. |
| Merge keys | The double angle bracket merge is applied during loading, and the merged keys appear directly on the object. |
| Multi-document streams | Not accepted. A file with three-dash separators fails with an error about expecting a single document. |
| Comments | Discarded, because JSON has no syntax for them. Move anything important into a real key first. |
| Timestamps | An ISO-style date becomes a Date during loading and is serialised into the JSON as an ISO 8601 string. |
| Indentation rules | Tabs are illegal as YAML indentation, so a file indented with tabs fails with a position in the error. |
| Multi-line scalars | Literal and folded blocks are resolved into ordinary strings with the newline handling each style implies. |
| Output format | JSON with two-space indentation, key order as the document declared it, no trailing newline added. |
| Extensions | Both .yaml and .yml are accepted by the picker, and paste and convert works without a file at all. |
| Error detail | Failures report the js-yaml message, which names the line and column where parsing stopped. |
What happens to your file
Config files are exactly the kind of document you should not paste into a remote service, and nothing here is transmitted. Pasted YAML stays in the input panel, an uploaded file is read on your device with the File API, and the copy of js-yaml bundled into this page does the loading in the same tab. Because the safe schema is in force, no tag in the document can cause code to run. The JSON is serialised locally and offered as clipboard text or as a download.
About this tool
- 1
Pick a mode
Paste and convert opens by default; switch to file upload for a .yaml or .yml file on disk.
- 2
Split multi-document files
If the file contains several documents separated by three dashes, convert them one at a time.
- 3
Convert
js-yaml loads the document, expanding anchors and merges, and the value is printed as indented JSON.
- 4
Check the ambiguous values
Look at anything that was written unquoted, particularly version numbers, times and country codes.
- 5
Copy or download
Copy the JSON, or save a .json file when you converted from an uploaded document.
| Input and output | Takes .yaml and .yml (text/yaml) and returns the JSON as a blob with the application/json type, named after the file you dropped in. |
|---|---|
| Engine | js-yaml 4.1.1 bundled into the page loads the YAML and JSON.stringify prints it with two-space indentation - no worker and no network call. |
| Modes | Both modes: paste the YAML in and copy the JSON straight back out, or hand over a file and take the JSON as a download. |
| Batch and caps | Twenty YAML files per run at 500 MB each; several JSON results are zipped in page memory as converted-json-files.zip. |
| Browser and device | YAML to JSON needs only the File API, a Blob download and the parser already in the bundle, so every current browser behaves the same and the page keeps working with the network off. |
- A Kubernetes manifest file usually holds several documents. Split on the three-dash separators and convert each part, or the load will fail on the first boundary.
- Quote anything that must stay a string: a version like 1.10 loads as a number and loses its trailing zero, and a code such as NO stays text only because YAML 1.2 no longer treats it as false.
- Anchors make YAML compact and JSON cannot express them, so expect the output to be longer than the input when a file reuses blocks heavily.
- If loading fails on a line that looks fine, check for tab characters. Editors that insert tabs silently break YAML indentation.
- Comments carry real information in most config files. Copy them somewhere before converting, because they are gone from the JSON for good.
- Convert a Docker Compose or CI pipeline file into JSON so a script or a validator can work with it programmatically.
- Turn an OpenAPI description written in YAML into the JSON form that many documentation and codegen tools expect.
- Inspect a deeply nested configuration in a format where every level is explicitly bracketed and easier to diff.
Related tools
View allNeed the opposite? Try JSON to YAML
Works well with this4
Other JSON tools11
More in Data & Dev12
Related categories1
Updated