5 Free YAML to JSON Converters — Online, CLI, and Code
- Browser converter: paste and click — fastest for one-off conversions, no install required.
- Python: yaml.safe_load + json.dumps — built into most systems, good for scripting.
- Node.js: js-yaml npm package — integrates with existing JavaScript toolchains.
- yq CLI: jq-style filtering for YAML — best for pipelines and shell scripts.
- VSCode extension: convert in-editor without leaving your IDE.
Table of Contents
The best free YAML to JSON converter depends on your workflow. For a one-off conversion, a browser-based tool wins — no install, paste and go. For scripts and automation, Python or Node.js is more practical. For terminal pipelines, the yq CLI is the standard tool. This guide covers five approaches, each free, each suited to a different context.
1. Browser-Based Converter — Fastest for One-Off Conversions
A browser-based YAML to JSON converter requires nothing installed. Open the page, paste your YAML, click Convert. Output is ready in under a second.
Best for: one-off conversions, verifying config file syntax, working on someone else's machine, converting sensitive data that shouldn't be sent to a server.
The free YAML to JSON converter on this site runs entirely in the browser — no upload, no server transmission. Supports bidirectional conversion (YAML↔JSON), the full YAML 1.2 spec including anchors and multiline strings, and error display with line references.
Limitations: manual one-at-a-time workflow; not scriptable; requires pasting text rather than pointing at a file path.
2. Python — Best When You Already Have Python Installed
Python's standard library includes json. The pyyaml package handles YAML parsing and is available on essentially every system that uses Python for DevOps work.
Install PyYAML if not present:
pip install pyyaml
One-liner to convert a file:
python3 -c "import sys,yaml,json; print(json.dumps(yaml.safe_load(open(sys.argv[1])),indent=2))" config.yaml
Script form:
import yaml, json, sys
with open(sys.argv[1]) as f:
data = yaml.safe_load(f)
print(json.dumps(data, indent=2))
Run: python3 convert.py config.yaml > config.json
Best for: automation scripts, CI pipelines, converting multiple files in a loop, teams that already use Python. Use yaml.safe_load() — never yaml.load() without a Loader argument, which can execute arbitrary Python code from YAML input.
3. Node.js — Best for JavaScript/TypeScript Toolchains
The js-yaml package is the standard YAML parser for Node.js. Install it with npm:
npm install js-yaml
Convert a file from the command line:
node -e "const yaml=require('js-yaml'),fs=require('fs');console.log(JSON.stringify(yaml.load(fs.readFileSync(process.argv[1],'utf8')),null,2))" config.yaml
In a script:
const yaml = require('js-yaml');
const fs = require('fs');
const data = yaml.load(fs.readFileSync('config.yaml', 'utf8'));
const jsonOutput = JSON.stringify(data, null, 2);
fs.writeFileSync('config.json', jsonOutput);
Best for: Node.js projects, build scripts, tools that already have a package.json, converting YAML as part of a JavaScript data pipeline.
4. yq — Best for Terminal Pipelines and Shell Scripts
yq is a command-line YAML processor in the style of jq. It can convert YAML to JSON, filter, transform, and query YAML documents from the shell.
Install on macOS: brew install yq
Install on Linux: snap install yq or download binary from GitHub.
Convert YAML to JSON:
yq -o=json config.yaml
Or read from stdin:
cat config.yaml | yq -o=json
Convert multiple files:
for f in *.yaml; do yq -o=json "$f" > "$(basename $f .yaml).json"; done
Best for: shell scripting, Makefile automation, CI/CD pipelines, engineers who prefer terminal tools, filtering specific keys out of a YAML document before converting.
5. VSCode — Best for In-Editor Conversion Without Leaving the IDE
Several VSCode extensions add YAML-to-JSON conversion as a command palette action. Install an extension that supports it, open a .yaml file, and run the conversion command — the output appears in a new editor tab or replaces the file content.
Search the VSCode Extensions marketplace for "yaml to json" or "yaml converter." Extensions like YAML (by Red Hat) and converter-specific extensions provide this functionality.
Best for: developers who spend their day in VSCode, occasional conversions during code editing, wanting to stay in the IDE rather than switching to a terminal or browser tab.
Limitations: requires the specific extension to be installed; not scriptable from outside the IDE.
Which YAML to JSON Converter Should You Use?
| Situation | Best Option |
|---|---|
| Quick one-off, no install | Browser converter |
| Sensitive file (credentials, secrets) | Browser converter (local-only) or local CLI |
| Automate multiple files | Python or yq shell loop |
| Node.js project | js-yaml |
| Shell pipeline / CI | yq |
| Staying in VSCode | VSCode extension |
All five options are free. None require a paid subscription for basic YAML-to-JSON conversion.
Try the Browser Converter — Zero Install
Paste your YAML and click Convert. Runs in your browser, no upload, no account. Works for any YAML file.
Open Free YAML to JSON ConverterFrequently Asked Questions
What is the best free YAML to JSON converter online?
For browser-based conversion, use a tool that runs locally in the browser with no file upload — this protects sensitive data and works without an internet connection after the page loads. The converter on this site runs entirely client-side with no server transmission.
Is there a command-line tool to convert YAML to JSON?
Yes. The yq CLI tool (brew install yq on macOS, snap install yq on Linux) converts YAML to JSON with: yq -o=json file.yaml. Python (pip install pyyaml) and Node.js (npm install js-yaml) also work well for scripted conversion.
Can I convert YAML to JSON in Python without extra libraries?
Not easily — Python's standard library does not include a YAML parser. You need to install pyyaml (pip install pyyaml). Once installed, yaml.safe_load() parses YAML and json.dumps() outputs JSON. If you absolutely cannot install packages, a subprocess call to a system tool like ruby or python3-yaml (on Linux) is an option.
How do I convert a large YAML file to JSON?
For large files (over a few hundred KB), browser tools become slow — use a CLI tool instead. Python and yq can process large YAML files efficiently from the command line. yq -o=json large-file.yaml > output.json handles large files well.

