Guide · JSON & Data

How to Convert YAML Config to JSON

Updated 2026-08-09 · 4 min read

YAML is what humans edit: CI pipelines, app settings, Kubernetes-style manifests, Ansible-ish snippets. JSON is what a surprising number of tools will actually accept. The one-off job is “this .yml needs to be a JSON object in my clipboard.”

YAML to JSON on DevOkk.com does that in the browser. No account. Config files are where secrets hide. Do not paste production keys into a random website. Browser-local is the safer default; dummy values are safer still when you only need the shape.

Config that only some tools will eat

You will hit this when:

  • A test runner or mock server wants config.json.
  • An API’s import box is JSON-only.
  • You are comparing two representations of the same settings.
  • A teammate sent YAML and your script calls JSON.parse.

Pasting YAML into JSON Formatter fails. Indentation and key: value are not JSON. Convert first.

Keep YAML as the file people edit. JSON is the derived artifact. If you convert, commit, and then edit the JSON by hand, you have two sources of truth. Pick one.

Comments, anchors, and implicit types

Comments. # deploy on Fridays will vanish. JSON has nowhere to put it. That is correct, and it is why YAML stays the human file.

Anchors and aliases. &defaults and *defaults expand. The JSON will repeat the map. File size goes up. Shared updates in YAML become duplicated updates in JSON. If you needed references, you left them behind.

Implicit types. YAML 1.1 famously turns NO, off, and n into booleans. Country code NO (Norway) has bitten real configs. Quote "NO" in the YAML if it must stay a string. Leading zeros and sexagesimal leftovers are parser-dependent. After conversion, look at the JSON types. Do not trust a silent cast.

Multiline strings. | and > become one JSON string with or without newlines. Check an ssh key or a command block. A folded > that lost a newline will break a script.

Multiple documents. --- separated streams are not one JSON value. Split them. A converter that emits an array of documents is being helpful; one that only reads the first document is being honest. Know which you got.

Tabs. YAML wants spaces. A tab can fail the parse. Re-indent.

A CI or Kubernetes snippet

A trimmed CI job:

jobs:
  test:
    image: node:22
    steps:
      - run: npm test
    env:
      NODE_ENV: test
      FEATURE_NO: "NO"

Convert with YAML to JSON. You want FEATURE_NO to remain the string NO, not false. If you forgot the quotes, the JSON will tell you. Fix the YAML, convert again.

A second snippet is a Deployment-like object: spec.replicas, spec.containers[0].image. After conversion, JSON Viewer is the right way to walk spec. The graph visualizer helps if you have never seen the nesting. JSON Formatter is enough for a 30-line file.

If env includes a real DATABASE_URL, stop. Replace it with a dummy URL before the paste, or do not use a website at all. Conversion copies every scalar.

Secrets sitting in YAML

Helm values, .env-adjacent YAML, and “just a local override” files regularly contain tokens. Treat them like JWTs. The DevOkk converter is designed to keep the text in the tab. That is better than an upload. It is not permission from your security team.

Prefer: convert a redacted copy, or convert only the keys you need to discuss (image, replicas), or run python -c 'import json,yaml,...' on your own machine when policy is strict.

XML and CSV are the wrong converters for this file. Tags go to XML to JSON. Tables go to CSV to JSON.

After the JSON exists

Format if you are reading. Minify if a tool wants compact JSON. View if the manifest is deep. Graph if you are teaching the shape.

Comments are gone; do not try to get them back. Anchors are expanded; do not expect identity between two copied maps.

Huge manifests can strain a tab. Sample a single resource from a list. Invalid YAML (bad indent, missing colon) should fail closed. A truncated paste is not a document.

If you are choosing which format to keep long-term, read JSON vs XML vs YAML vs CSV.

Convert a config with no secrets first

Open YAML to JSON with a config that has no secrets. Check types and expanded anchors. Then convert the real file only if you are willing to have those scalars in browser memory. Continue with JSON Formatter if you need to read the result. The hub is JSON tools.

Frequently asked questions

Does YAML to JSON require an account?

No. YAML to JSON opens without an account. Paste the YAML, convert it in the browser, copy the JSON, and close the tab.

Does the converter upload my config?

YAML to JSON is designed to process the text in your browser. The file is not sent to complete the conversion.

The YAML contains a password or API key. Should I convert it online?

Do not paste production secrets into random websites. If you must convert a sensitive config, a browser-local tool is the safer default. Prefer dummy values when you are only checking shape.

Why did my comments disappear?

JSON has no comment syntax. A correct converter drops them. Keep the YAML as the human source of truth.

What happens to anchors and aliases?

They expand into duplicated JSON structure. That is expected. If you needed a shared reference, JSON cannot express it; you get copies.

The output types look wrong (NO, 1.0, 08).

YAML implicit types are a footgun: NO can become false, leading zeros can become octal in older YAML, 1.0 may become a float. Quote values that must stay strings, then convert again.

More reading that links back to the same tools and workflows.