YAML to JSON converter (and JSON to YAML)
Use this YAML to JSON converter to turn YAML into JSON, and JSON back into YAML. The conversion follows YAML 1.2: nested objects, lists, multi-line text blocks, anchors with aliases and multiple documents are understood. Errors name the line, and your data never leaves the browser.
Source: YAML Language Specification, Version 1.2.2 (Syntax, Core-Schema, Skalar-Typen). Updated: .
How it is calculated
YAML is a readable data format for configuration, used for example in Docker Compose, Kubernetes, GitHub Actions or OpenAPI. JSON is understood by nearly every programming language and API. This tool converts in both directions.
How to convert YAML to JSON
- Choose the direction “YAML → JSON” above.
- Paste your YAML or tap “Sample text”.
- Copy the JSON or download it as a file. “Use result as input” reverses the direction so you can check that the result converts back to the same thing.
What is supported
Nested objects and lists, values in square and curly brackets, text in single and double quotes (also across several lines), text blocks with | and > including chomping, comments, anchors with aliases and merge keys (<<), multiple documents with --- and the tags !!str, !!int, !!float, !!bool and !!null.
Types according to YAML 1.2
- Booleans: only
trueandfalse(in any of the usual capitalisations) are booleans.yes,no,onandoffstay text, as YAML 1.2 specifies. Older YAML 1.1 programs read them differently. - Numbers:
007becomes 7,0x1Fbecomes 31,1e3becomes 1000. Very large integers are kept digit-exact. - Dates:
2024-01-01stays text because JSON has no date type. - JSON → YAML: text that could be mistaken for a number, boolean or date is quoted automatically. Order and values are preserved.
Limits
Complex keys (? ), custom tags and anchors on keys are not supported; you get an error message instead of a silent misreading. Comments are lost when converting to JSON because JSON has none. XML is not converted here. For JSON → YAML, numbers above 2^53 lose precision in the browser’s JSON parser, and numeric keys always come first in JSON.
Your text stays in your browser and is neither sent nor stored.
Frequently asked questions
How do I convert YAML to JSON?
Choose the direction “YAML → JSON” and paste the YAML. The JSON appears immediately and you can copy or download it. If something is wrong, the message names the line.
Why does “yes” not become true?
Because this tool uses YAML 1.2. There only true and false are booleans; yes, no, on and off stay text. YAML 1.1 treated them as booleans, which often caused bugs (the “NO” for Norway problem).
Are comments lost?
Yes, when converting to JSON, since JSON has no comments. In the other direction the YAML has no comments because the JSON contains none.
What happens with several documents in one file?
Documents separated by --- are combined into one JSON list, one entry per document. A single document stays as it is.
How are anchors and aliases handled?
An alias is replaced by the value of its anchor. The merge key “<<” inserts the keys of an anchor; existing keys take precedence. Extremely branching aliases are rejected as abuse.
Is my input uploaded?
No. The conversion runs in your browser; the text is not sent, not stored and not written to the address bar.
Sources and legal basis
- YAML Language Specification, Version 1.2.2 (Syntax, Core-Schema, Skalar-Typen)
- IETF RFC 8259 – The JavaScript Object Notation (JSON) Data Interchange Format
- YAML 1.1 – Merge Key Language-Independent Type (<<)
- YAML Core Schema 1.2 – Tag Resolution (null, bool, int, float)
As of: · Editorial policy
Related tools
- JSON formatter, validator and minifierValidate JSON against RFC 8259 with the exact line, column and a plain-English explanation. Beautify or minify, sort keys, copy. Runs locally in your browser.
- CSV to JSON converter (and JSON to CSV)Convert CSV to JSON or JSON to CSV online: delimiter auto-detected, numbers and booleans typed, quoted fields handled. Runs in your browser, nothing uploaded.
- XML and CSV validator onlineCheck XML for well-formedness and validate CSV against RFC 4180: errors with line and column, auto-detected delimiter, table preview. Runs locally.
- SQL formatter (format SQL online)SQL formatter for readable queries: uppercase keywords, indentation, columns and conditions on separate lines. Also minifies SQL. Runs locally in your browser.
- What is my IP address?What is my IP? See your public IPv4 or IPv6 address at once, plus approximate location, internet provider and browser details. Free, never stored.
- Markdown table generatorMarkdown table generator: paste data from Excel, Google Sheets or CSV and copy it as an aligned Markdown, HTML or LaTeX table – locally in your browser.
- UUID generator: create and validate UUID v4 and v7Generate UUIDs online: version 4 (random) or version 7 (time-ordered), up to 1,000 at once. Validate a UUID and decode its version, variant and timestamp.
- IBAN CheckerValidate any IBAN: mod-97 check digits, length and structure for 89 countries, plus bank and BIC for German IBANs. Runs in your browser – nothing is sent.
- HTML formatterHTML formatter: indent source code to make it readable, or minify it to a single line, with warnings about unclosed tags. Runs locally in your browser.