# YAML to JSON Converter

> Parse YAML into structured JSON, instantly in your browser. Useful for reading Kubernetes manifests, GitHub Actions workflows, and any YAML config.

URL: https://uttir.com/yaml-to-json
Categories: data-tools, developer-tools
Privacy: Parsing runs locally in your browser. Your YAML never leaves the page.

## About

YAML is the format you will find in Kubernetes manifests, GitHub Actions workflows, Ansible playbooks, Docker Compose files, and most modern configuration. It is more human-friendly than JSON but harder to read once it gets past a few levels of nesting.

This tool takes YAML and renders it as pretty-printed JSON, so you can see the actual structure (objects, arrays, scalar values) at a glance. It also flags common YAML errors with the line and column where they occurred, so you can fix typos before committing.

## How to use

1. **Paste your YAML** — Drop a YAML document into the input.
2. **Read the JSON** — The output updates as you type. Click any key in the tree preview to collapse the rest.
3. **Copy or download** — Use Copy for the clipboard, or Download to save as a .json file.

## Examples

### Service manifest

A Kubernetes-style service definition as YAML, parsed to JSON.

Input:

```
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  ports:
    - port: 80
      targetPort: 8080
```

Output:

```
{
  "apiVersion": "v1",
  "kind": "Service",
  "metadata": { "name": "web" },
  "spec": { "ports": [{ "port": 80, "targetPort": 8080 }] }
}
```

### GitHub Actions workflow

A minimal CI workflow as YAML, parsed to JSON.

Input:

```
name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm test
```

Output:

```
{
  "name": "CI",
  "on": ["push"],
  "jobs": { "test": { "runs-on": "ubuntu-latest", "steps": [{"uses": "actions/checkout@v4"}, {"run": "npm test"}] } }
}
```

## FAQ

### What subset of YAML is supported?

The common block-style subset: mappings (key: value), sequences (- item), scalars (strings, numbers, booleans, null), inline tables, and arrays of tables. Anchors/aliases, flow-style collections, and heredocs are not supported.

### Why does my multi-line string come out as one line?

JSON has no multi-line string type, so the tool joins multi-line YAML scalars into a single \n-separated string. That is the correct JSON representation — when a downstream consumer reads it back, the newlines are preserved.

### How do I know where a YAML error is?

When the parser fails, the output shows the line and column number where the error was detected. YAML is whitespace-sensitive, so the most common cause is a misaligned indent.

## Related tools

- [JSON to YAML Converter](https://uttir.com/json-to-yaml) — Convert JSON to clean YAML and decode YAML back to JSON. Round-trips common JSON shapes.
- [JSON Formatter](https://uttir.com/json-formatter) — Format, beautify, and validate JSON with adjustable indentation — instantly in your browser.
- [TOML ↔ JSON Converter](https://uttir.com/toml-json-converter) — Convert TOML to JSON and JSON to TOML, instantly in your browser. Useful for pyproject.toml, Cargo.toml, and any modern config file. Free, no upload.
- [JSON Tree Viewer](https://uttir.com/json-tree-viewer) — Paste any JSON and explore it as a collapsible tree. Click any value to copy it, or copy the whole path. Free, runs in your browser, no upload.

---

For the full HTML page with the live tool, visit https://uttir.com/yaml-to-json.
This file is the markdown rendering at https://uttir.com/yaml-to-json.md. See https://uttir.com/llms.txt for a site-wide summary.
