Skip to content
ToolsMinify logo
All articles

YAML to JSON for DevOps - Compose, Actions, and Kubernetes

Convert Docker Compose, GitHub Actions, and Kubernetes YAML to JSON without uploading secrets. Cover multi-document --- streams, the Norway problem (NO as a string), and when to prefer JSON vs YAML.

Updated November 10, 20268 min read

Use YAML to JSON Converter - Free

Open the live tool and apply what you learned in this guide.

Open YAML to JSON Converter

DevOps configs live in YAML. APIs, test fixtures, and many CLIs want JSON. That split shows up every day: a compose.yaml you need as a fixture, a GitHub Actions workflow you want to inspect as nested JSON, or a Kubernetes Deployment you must hand to a tool that only eats objects. The free YAML to JSON Converter runs in your browser so secrets never leave the device. This guide covers the paste workflows that matter, multi-document streams, the Norway problem, and when JSON or YAML should own the truth.

Quick answer

Keep YAML as the human-edited source for Compose, Actions, and Kubernetes. Convert to JSON when a consumer, fixture, or API needs strict types and no comments. Prefer YAML 1.2 CORE so country code NO and the word yes stay strings. Multi-document files separated by --- become a JSON array - one element per document.

Docker Compose, GitHub Actions, and Kubernetes

Those three formats dominate paste-and-convert traffic. A Compose services block becomes typed JSON for an API or test harness - quoted ports like "8080:80" stay strings; numbers and booleans keep JSON types. A workflow YAML excerpt converts so you can see nesting without fighting indentation. A Deployment with apiVersion, kind, metadata, and spec converts cleanly; quote version strings such as "1.25" when you need a string, not a float. Load the built-in samples on the tool page, or paste your own file - nothing is uploaded.

  • compose.yaml / docker-compose.yml services and networks as JSON fixtures
  • GitHub Actions workflow excerpts for nesting review or fixture edits
  • Kubernetes Deployment, Service, and ConfigMap objects for object-only tools
  • Swap JSON back to YAML when you prefer hand-editing the result

Multi-document YAML streams (---)

Kubernetes and some Helm-adjacent workflows ship several resources in one file, separated by ---. A converter that only returns the first document silently drops the rest. The right DevOps mapping is a JSON array: document order preserved, one object (or scalar) per document. Swap direction on an array of objects to re-emit a --- separated YAML stream. Watch the doc-count badge so you know how many documents landed in the array - that catches truncated pastes and accidental blank docs.

  • Two manifests separated by --- become a two-element JSON array
  • Empty documents and trailing --- still count - check the badge
  • Round-trip with Swap when you need the stream form again
  • Prefer one resource per file in git when diffs matter more than paste convenience

The Norway problem - keep NO as a string

YAML 1.1 treats unquoted yes, no, on, off, y, and n as booleans. Country code NO therefore becomes false in JSON - the classic Norway problem. YAML 1.2 CORE keeps NO and yes as strings unless you write true/false explicitly. Default to YAML 1.2 for new configs and for any file that carries country codes, feature flags spelled yes/no, or switch labels like on/off. Toggle YAML 1.1 only when a legacy consumer requires those coercions. Use the type census after convert: if a key you expected as a string shows boolean, quote it in the source or stay on 1.2.

When to prefer JSON vs YAML

Prefer YAML when humans edit the file in git: comments, anchors, and readable indentation help reviews. Prefer JSON when machines exchange the data: APIs, many SDKs, and strict schema validators expect JSON types with no comments. Convert YAML to JSON for fixtures and object APIs; convert JSON to YAML when you need a hand-editable view of a blob. For a broader format comparison - nesting, CSV flatness, and classic traps - see JSON vs YAML vs CSV. Pair JSON output with the JSON Minifier & Formatter when you need a one-line payload, or the XML to JSON Converter when the source is markup instead of YAML.

  • YAML source of truth for Compose, Actions, Helm values, and K8s manifests
  • JSON for REST bodies, typed fixtures, and tools that reject YAML
  • Expect comments to disappear on YAML to JSON - JSON has no comment syntax
  • Quote ambiguous scalars (NO, version numbers) when type safety matters

Privacy - convert locally, do not upload configs

Compose files, workflow secrets references, and cluster manifests often name internal hosts, image registries, and env keys. Browser-side conversion keeps that text on your device: paste YAML, copy JSON, done. That is the point of a local converter versus an upload pastebin. Open DevTools Network while you convert if you want proof nothing left the tab. The tool page owns transactional searches like yaml to json converter; this article covers the DevOps why.

A practical workflow

  • Keep Compose / Actions / Kubernetes YAML in git as the editable source
  • Open the YAML to JSON Converter when a consumer needs JSON
  • Use YAML 1.2 CORE unless you knowingly need 1.1 booleans
  • For multi-doc streams, confirm the JSON array length matches the document count
  • Check the type census for silent coercions (Norway problem)
  • Optional: Swap back to YAML, or minify JSON for a compact fixture

Try a real Compose or manifest paste

SERP summaries explain the formats; they cannot safely hold your private config. Paste a real compose.yaml, workflow, or Deployment and convert locally.

Frequently asked questions

Should Docker Compose stay YAML or become JSON?

Keep Compose as YAML in the repo - that is what Docker and most teams expect. Convert to JSON only when a test harness, API, or internal tool needs an object. Do not maintain two hand-edited copies.

How do multi-document YAML files become JSON?

Documents separated by --- become a JSON array in source order. An array of objects can Swap back into a --- separated YAML stream.

Why did country code NO become false?

That is the Norway problem under YAML 1.1. Switch to YAML 1.2 CORE, or quote the value as "NO", so it stays a string in JSON.

Is my YAML uploaded when I convert?

Not on ToolsMinify. Parsing runs in the browser, so manifests with secrets and internal hostnames stay on your device.

Convert YAML without uploading

Open the free YAML to JSON Converter, paste Compose, Actions, or Kubernetes YAML, pick YAML 1.2, and copy JSON - private, in-browser.

Use YAML to JSON Converter - Free

Open the live tool and apply what you learned in this guide.

Open YAML to JSON Converter

Related articles