Skip to content

Menu

YAML ↔ JSON Converter

Convert between YAML and JSON formats with validation

Runs entirely in your browserFormattersFree, no sign-up
Loading tool

01What is YAML ↔ JSON Converter?

YAML / JSON Converter converts in both directions, and the output refreshes as you type. It's handy when a Kubernetes manifest needs to go through jq, or a JSON blob needs to become a config file. YAML is read with the YAML 1.2 core schema rules. true, false, null and ~ are recognised. Integers can be decimal, 0x hex or 0o octal, and floats include .inf and .nan. Unquoted yes, no, on and off stay strings. That matters more than it sounds. YAML 1.1 parsers turn them into booleans, which is why the on: key in a GitHub Actions workflow comes out as true in some tools. Supported syntax covers nested block mappings and sequences and flow collections such as [a, b] and {a: 1}, even across lines. It also handles single- and double-quoted strings with escapes, literal (|) and folded (>) block scalars with chomping indicators, and comments. Anchors, aliases and << merge keys work too. They are expanded inline, because JSON has no way to express references. Here's a quick example. Paste country: NO, version: 1.10 and enabled: yes on three lines. The JSON keeps "NO" and "yes" as strings, but version becomes the number 1.1 and loses its trailing zero. Quote version numbers if that zero matters. A key that appears twice in one mapping is reported with both line numbers, rather than quietly keeping the last value. Plenty of parsers just let the second one win, so this catches real copy-paste mistakes. Unquoted text can wrap onto more-indented lines. It's joined the way YAML 1.2 folds lines: a single line break becomes a space and a blank line becomes a newline. Tags work too. !!str 123 gives the string "123", and !!int, !!float, !!bool, !!null, !!seq and !!map set the type the same way. Two YAML 1.1 tags are applied as well. A !!binary value has to be valid base64 and comes out as the base64 string with its line breaks removed, since JSON has no bytes. A !!timestamp value becomes an ISO 8601 string in UTC, so !!timestamp 2001-12-14 21:59:43.10 -5 gives "2001-12-15T02:59:43.1Z", and a date alone stays YYYY-MM-DD. Untagged dates stay plain strings, as YAML 1.2 says. A custom tag such as !point has no JSON equivalent, so the value is kept as written and a note above the output names the tag and its line. Several documents separated by --- are converted together. The JSON is then an array with one element per document, and a note says how many there were. Explicit ? keys work too. A key that is itself a list or map has no JSON equivalent, so it is written as its JSON text, such as ["a","b"], and the note gives its line. The duplicate-key check doesn't compare ? keys. The parser is deliberately small, so what it can't read fails loudly instead of giving wrong output. Also, JSON has no Infinity or NaN, so .inf and .nan come out as null. Going the other way, JSON becomes block-style YAML with two-space indentation. Any string a YAML 1.1 or 1.2 parser could read as a boolean, null or number ("yes", "123", "") is double-quoted, keys included. That way the YAML reads back the same in either kind of parser. You can copy the result or download it as converted.json or converted.yaml. The parsing happens in JavaScript inside your tab, so config files with secrets in them never get uploaded.

DevOps and backend developers who move Kubernetes, Compose, GitHub Actions or app configs between YAML and JSON and want to see exactly how each value is typed. The tool runs entirely in your browser, so your data never leaves your device.

02How to use YAML ↔ JSON Converter

  1. Choose the YAML to JSON or JSON to YAML tab, or load one of the examples
  2. Paste your YAML or JSON into the input panel; the output updates as you type
  3. If an error appears, fix the line it names and the output reappears
  4. Copy the result or download it as converted.json or converted.yaml

03Worked examples

Input: YAML to JSON: server: port: 8080 hosts: - a.example.com - b.example.com
Result: { "server": { "port": 8080, "hosts": [ "a.example.com", "b.example.com" ] } }
Input: YAML to JSON: country: NO version: 1.10 enabled: yes
Result: { "country": "NO", "version": 1.1, "enabled": "yes" }
Under YAML 1.2, NO and yes stay strings, but an unquoted 1.10 is a number and loses its trailing zero; quote version numbers.
Input: JSON to YAML: {"country":"NO","version":"1.10","on":"yes","n":null,"empty":[]}
Result: country: "NO" version: "1.10" "on": "yes" "n": null empty: []
Strings that a YAML 1.1 parser could read as booleans, numbers or null are quoted, keys included, so the YAML reads back the same.
Input: YAML to JSON: a: 1 a: 2
Result: Line 2: Duplicate key "a" (first used on line 1); YAML requires keys in a mapping to be unique
Input: JSON to YAML: {"msg":"line1\nline2","path":"a: b"}
Result: msg: "line1\nline2" path: "a: b"
A value containing ": " is quoted because unquoted it would be read as a nested key.
Input: YAML to JSON: base: &b retries: 3 timeout: 30 prod: <<: *b timeout: 60
Result: { "base": { "retries": 3, "timeout": 30 }, "prod": { "retries": 3, "timeout": 60 } }
The merge key copies retries from base, and the local timeout wins over the merged one.

04Common use cases

  • Converting a Kubernetes manifest or Docker Compose file to JSON so you can query it with jq
  • Turning a JSON API response or package.json into YAML for a config template
  • Checking how a GitHub Actions workflow is actually parsed, including the on: key
  • Expanding YAML anchors and merge keys to see the effective configuration
  • Producing YAML from JSON that stays correct for both YAML 1.1 and 1.2 parsers
  • Catching a duplicated key in a Helm values file before it silently overrides an earlier setting

05Tips

  • Values like yes, no, on and off are strings under YAML 1.2; if another tool of yours reads YAML 1.1, quote them or use true/false
  • Anchors and merge keys are expanded in the JSON, so a heavily aliased file can get noticeably longer
  • JSON has no Infinity or NaN, so YAML .inf and .nan come out as null in the JSON output
  • Unquoted text may wrap onto more-indented lines and is joined with single spaces; use a | block scalar when the line breaks themselves matter
  • A file with several --- documents becomes a JSON array with one element per document; paste one document if the next tool expects a single object

06Related concepts

YAML 1.2, JSON5, TOML, Kubernetes manifest.

Frequently Asked Questions

What is YAML ↔ JSON Converter?

YAML ↔ JSON Converter is a free, browser-based developer tool on AIDToolStack. Convert between YAML and JSON formats with validation It requires no installation or sign-up and works entirely in your browser.

Is YAML ↔ JSON Converter free to use?

Yes. No sign-up, no fees and no usage cap.

Does YAML ↔ JSON Converter store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe