How to Convert JSON to YAML
The fastest way is a browser-based converter — no install, no upload.
Method 1: Use the online converter (recommended)
- Open the JSON to YAML converter.
- Paste your JSON into the left box.
- The YAML output appears on the right automatically, with clean 2-space indentation.
- Copy or download the result.
Everything runs in your browser, so your data never leaves the page.
Method 2: Convert with a code snippet
In Node.js with js-yaml installed:
const yaml = require('js-yaml');
const yamlText = yaml.dump(JSON.parse(jsonText), { indent: 2 });
Common gotchas
- Indentation matters. YAML uses spaces, not tabs.
- Duplicate keys are invalid and will error.
- Long strings may be wrapped with line folds — that is valid YAML, just harder to read.
Not sure your result is valid YAML? Run it through the YAML validator first.
Going the other direction? See how to convert YAML to JSON.