All free toolsConverters

Convert Kubernetes & Docker YAML configurations into JSON and back.

26free converters

Local processing limits: 50 MB per file, 20 files and 100 MB per selection. Some tools have stricter limits. Large or complex files can still exceed device memory.

Your files stay private·Nothing is stored or retained
Free, no sign-up·No watermark

Input

⬆
Drop a file or paste below
Accepted: .yaml, .yml, .json, .txt

Output

Processing and privacy: YAML ↔ JSON

File processing runs in your browser. Your selected file is not uploaded by this tool. The website still receives ordinary page and asset requests. Keep your browser updated and review the output before sharing it.

File sizes and processing time depend on the tool and your device. Safety limits may apply; unlimited file sizes and instant completion are not guaranteed.

Complete Master GuidePublished by Cortexis Solution Hub Pvt Ltd Document Research Lab • 9 min read

A Free YAML to JSON Converter That Keeps Your Types: Both Directions, Real Errors, Honest Limits

A Kubernetes manifest a script wants as JSON, or an API response that belongs in a config file. Each is a quick YAML to JSON or JSON to YAML job, and each has the same trap: a converter that quietly turns the country code NO into false, or strips the zero from the front of a zip code. This guide shows how to use the YAML to JSON converter above in either direction, what it does with types, what its errors mean, and — plainly — what it cannot handle yet.

A laptop showing indented code in a dark editor on a bright white desk
Same data, two notations, types and key order kept.

1. YAML vs JSON: What Converting Actually Changes

The YAML vs JSON question is mostly about who reads the file. YAML uses indentation instead of brackets, allows comments and anchors, which is why people write configuration in it. JSON is stricter, with quoted strings, braces and no comments, which is why programs and APIs prefer it. Its grammar is set out in RFC 8259.

Converting moves the data, not the decoration. Maps become objects, sequences become arrays, and scalars become strings, numbers, booleans or null. Comments disappear, anchors are written out in full wherever they were used, and key order is preserved.

The tool also works as a quick YAML validator in the narrow sense: text that parses is well-formed, and text that does not gets a message, usually with a line number. It does not check the file against a schema.

2. How to Convert YAML to JSON (or JSON to YAML)

Here is how to convert YAML to JSON with the tool above. The input box opens with a sample Kubernetes-style service block, so you can press Convert first and see the shape of the result.

  1. Paste or drop your file. Paste text into the box, or drop a single .yaml, .yml, .json or .txt file onto the panel. The yml to json case is identical; the extension makes no difference.
  2. Pick the direction. The Conversion menu offers YAML → JSON (the default) and JSON → YAML.
  3. Choose the indent. Two spaces is the default; four spaces is there for projects that use it. The setting applies to either direction, so it gives you YAML to JSON pretty print output and JSON to YAML 4 space indent output from the same menu.
  4. Convert, then copy or download. Press Convert. The result appears in the right-hand box with a Copy button and a Download button that saves data.json or data.yaml.

That is also how to convert JSON to YAML: switch the menu, paste the JSON, press Convert. Conversion runs when you press the button, not on every keystroke.

Inside a pipeline, a script fits better: convert YAML to JSON Python usually means a YAML library plus the json module, and a command-line YAML processor gives you a shell one-liner. Whichever you use, check which YAML version it follows: a library on the older 1.1 rules can turn NO into false where this page would not. For a one-off check, pasting it here is quicker.

3. The YAML Norway Problem, and Why NO Stays “NO”

The YAML Norway problem is the classic surprise: a list of country codes goes in, and Norway comes out as false. It happens because the older YAML 1.1 rules treated yes, no, on and off as booleans. The current YAML 1.2 specification dropped that, and this converter follows the 1.2 core rules. If you have seen YAML yes no converted to true false, here is what you get instead:

  • country: NO becomes "NO" and enabled: yes becomes "yes": both stay strings. Only true and false (in any capitalisation) become booleans.
  • port: 8080 becomes the number 8080, as do hex like 0x1F, floats and .inf.
  • null, ~ and an empty value become null. Dates and times such as 22:30 stay strings.

The reverse direction protects the round trip: JSON to YAML quotes strings YAML would misread, such as "no", "on" or "1.0", and writes multi-line strings as literal | blocks.

Unquoted numbers are still numbers. If you are here because of YAML leading zero removed, this is the rule: zip: 01234 becomes 1234 and version: 1.10 becomes 1.1, because both are valid numbers. Quote them in the YAML (zip: "01234") and they come through as strings, exactly as written.

4. Kubernetes, Compose, Helm, Actions and OpenAPI

Most YAML that needs converting is configuration, and each kind has one detail worth knowing.

  • Convert Kubernetes YAML to JSON for kubectl patch, an API call or a script: a single manifest converts cleanly. A file with several resources separated by --- needs splitting first (see section 6).
  • Docker Compose YAML to JSON: services, ports, volumes and environment blocks all convert. If the file reuses settings with <<: *defaults, that merge is not expanded.
  • Helm values YAML to JSON, for --set-json or a values schema: nested maps and lists keep their types, which matters for region and feature-flag values.
  • GitHub Actions workflow YAML to JSON: the on: key stays the string "on" rather than turning into true, and ${{ }} expressions are kept as text.
  • OpenAPI JSON to YAML: paste a Swagger or OpenAPI spec, switch to JSON → YAML, and get the readable form with status codes such as "200" kept as quoted keys.
  • Ansible YAML to JSON: playbooks and inventory convert for inspection; yes/no values stay strings, so check anything your tooling expects as a boolean.

YAML anchors and aliases to JSON work the way you would hope: define base: &b once, reference it with *b, and the JSON contains the full block in both places.

5. What Each Error Message Means and How to Fix It

Errors appear above the output box, and your input is left as it was.

  • Invalid YAML near line N or Unexpected content at line N: usually a line indented to a level that does not match its siblings. Line it up with the keys it belongs beside.
  • Bad flow sequence or Bad flow mapping: an inline [ ] list or { } map that was never closed, or has a stray comma.
  • Unknown alias *name: a *name reference with no matching &name, often a typo.
  • Invalid JSON: …: the JSON → YAML input did not parse. The detail often reads like unexpected token in JSON at position N; look there for a trailing comma, single quotes or a comment.

Two messages from other YAML tools deserve a note. Found character that cannot start any token (YAML tab) means a tab was used for indentation, which YAML forbids. This converter does not report tabs but mis-reads them, so replace indenting tabs with spaces first. The YAML error mapping values are not allowed here means a second colon on one line or a key indented under a value. Here, a line such as a: b: c does not raise an error: it becomes the string "b: c", so glance at the output and check the nesting is what you meant.

6. What It Does Not Do, With the Workaround

This converter reads a practical subset of YAML. These are the cases it does not handle, so you know before you rely on the output.

  • YAML multiple documents to JSON. The --- separators are ignored, so two documents merge into one object and later duplicate keys overwrite earlier ones. Split the file and convert each document separately.
  • Merge keys. <<: *base is kept as a literal "<<" key holding the anchored map. Copy the shared keys into each block if you need them flattened.
  • Custom tags. CloudFormation !Ref, !GetAtt, !Sub or !!binary are not interpreted; the tag text stays inside the string value.
  • Comments. Dropped going to JSON, never added going to YAML.
  • Schema checks. It confirms the text parses, not that the file is valid for Kubernetes or OpenAPI.
  • JSON with comments or trailing commas. JSONC and JSON5 fail with Invalid JSON. The JSON formatter helps you find the offending character.
  • Tab indentation. Tabs are not reported as an error and are mis-read, so replace indenting tabs with spaces before you convert.
  • Leading and trailing zeros in bare numbers. 01234 becomes 1234 and 1.10 becomes 1.1. Quote the value to keep it exactly.
  • Batch or live conversion. One file or paste per press of Convert; there is no multi-file mode and no convert-as-you-type.
  • Side-by-side comparison. To see what changed between two versions of a config, paste both into the diff checker.

For other formats, use the CSV to JSON converter, the XML to JSON converter and the SQL to CSV tool instead.

7. Why Cortexis Is the Best Free YAML JSON Converter

Plenty of pages offer a JSON to YAML converter online; few say which YAML rules they follow. This one is a YAML JSON converter free of sign-ups, and here is what you can check.

Genuinely free, no account

No sign-up, no email and no daily limit. The tool on this page is the whole product.

YAML 1.2 types, stated plainly

NO, yes and on stay strings; only true and false are booleans. You know in advance what the JSON will contain.

Both directions, one page

YAML to JSON and JSON to YAML from the same menu, with 2 or 4 space indent, and risky strings quoted on the way back.

Your config stays private

Files and pasted text are never stored on our servers and nothing is retained after your session.

Nothing is used for training

Your manifests, values files and API specs are never used to train any model.

Errors and limits you can act on

Messages carry a line number or alias name, and every limit comes with a workaround.

It sits alongside a wider set of free developer and file tools built on the same terms.

8. Frequently Asked Questions (FAQ)

How do I convert YAML to JSON for free?

Paste your YAML or drop a .yaml or .yml file into the tool above, leave the direction on YAML to JSON and press Convert. Copy the result or download it as data.json, with no account needed.

Can it convert JSON to YAML as well?

Yes. Switch the Conversion menu to JSON to YAML, paste the JSON and press Convert, then copy it or download data.yaml. Strings YAML would misread, such as "no" or "1.0", are quoted.

Will NO or yes turn into false or true?

No. The converter follows YAML 1.2 core rules, so only true and false in any capitalisation become booleans. NO, yes, on and off stay strings in the JSON, which avoids the Norway problem.

Why did my zip code or version number change?

Unquoted values that look like numbers become numbers, so 01234 becomes 1234 and 1.10 becomes 1.1. Quote the value in your YAML to keep the exact string.

How do I convert YAML multiple documents to JSON, such as a Kubernetes file split by ---?

Not in one go. The separators are ignored, so the documents merge into one object and duplicate keys overwrite. Split the file at each --- and convert each part, then combine the results into a JSON array yourself if you need one.

Do I need a command-line tool to convert YAML to JSON?

No. You can convert YAML to JSON online here, with no terminal command or script to write: paste or drop one file, press Convert, and copy or download the result. A command-line tool still makes more sense for converting many files at once, since this converter handles one file per click.

Does it check my YAML against a Kubernetes or OpenAPI schema?

No. It tells you whether the text parses, which catches syntax mistakes but not a wrong field name or a missing required key. For checking the JSON side, use the JSON formatter.

Is it safe to paste a config that contains secrets?

Your text and files are never stored on our servers, nothing is retained after your session, and nothing is used for training. As a habit, rotate any secret that has been pasted anywhere it should not be.

Are YAML comments kept in the JSON?

No. JSON has no comment syntax, so comments are dropped when converting to JSON, and none are added going the other way.

Converted and moving on? Tidy or minify the result with the JSON formatter, encode a value for a Kubernetes secret with the Base64 encoder and decoder, inspect a token from your config with the JWT decoder, or compare two versions of a file with the diff checker. To write the conversion yourself, our free Python development course and full-stack web development course cover the data formats behind tools like this one.