YAML ↔ JSON Converter
Convert YAML to JSON and JSON to YAML, format YAML 1.2 documents, validate syntax, and process local configuration files.
Your YAML and JSON are processed locally in your browser.
How to use it
- Choose YAML to JSON or JSON to YAML, then paste content or open a local file.
- Convert automatically or use Convert, Format input, and Validate for explicit control.
- Review document and byte counts, then copy or download the valid output.
Example
service: name: naminc.tech enabled: trueOutput
{
"service": {
"name": "naminc.tech",
"enabled": true
}
}Convert YAML and JSON
Use YAML to JSON for configuration data and JSON to YAML for a more human-readable representation. Format and validation actions help inspect either input before it is used elsewhere.
YAML 1.2 and JSON
YAML supports comments, anchors, aliases, multiline strings, and multiple documents. JSON has a smaller data model that is widely used by APIs and does not support comments.
Multiple YAML documents
A YAML stream may contain documents separated by three hyphens. This converter returns them as an ordered JSON array and reports the number of documents instead of silently selecting the first one.
Anchors and aliases
Anchors define reusable YAML values and aliases reference them. The converter resolves a bounded number of aliases and rejects excessive expansion or circular structures before producing JSON.
Comments and number limits
Formatting YAML preserves comments, but converting through JSON does not. Integers outside JavaScript's safe range, NaN, and Infinity are rejected so the converter never silently emits an inaccurate JSON number.
Common questions
- Does this converter upload my YAML or JSON?
- No. Parsing, conversion, file reading, copying, and downloads happen inside your browser. Input and output are not stored after reload.
- Are YAML comments preserved?
- Format input preserves YAML comments. Comments disappear when YAML is converted to JSON because JSON has no comment syntax.
- How are multiple YAML documents converted?
- Each valid document becomes an item in one ordered JSON array. A parsing error identifies the affected document and stops the conversion.
- Are YAML custom tags supported?
- No. The converter uses the YAML 1.2 core schema and rejects unresolved or custom tags instead of executing or interpreting application-specific values.
- Why are some large integers rejected?
- Standard JSON numbers are commonly handled as JavaScript numbers. Integers outside the safe range could be rounded, so the converter reports an error rather than changing the value.