YAML to JSON
Convert yaml to json using the available input and format options.
About YAML to JSON
Docker Compose files, GitHub Actions workflows and Kubernetes manifests are written in YAML, but scripts and APIs often want JSON. This converter suits quick checks of simple, indentation-based YAML, such as a flat settings file or a small nested config, when you want to see the equivalent JSON object.
How it works
This is a small custom parser that covers only a subset of YAML. Tabs become two spaces, and blank and # comment lines are skipped. Each key: value line becomes a property. A key with nothing after the colon starts a nested object, based on indentation. Lines starting with - become array items, stored as plain strings. Values that look like plain numbers become JSON numbers. Surrounding quotes are stripped. Everything else stays a string, including true, false and null.
How to use YAML to JSON
- Enter the text or data in the format shown in the text box above (Paste YAML).
- Select “Run tool” and check the result before copying or downloading it.
Worked example
Input lines: name: demo, version: 2, debug: true, server: with host: localhost and port: 8080 indented under it, then tags: with - web and - api indented under it. Output: {"name": "demo", "version": 2, "debug": "true", "server": {"host": "localhost", "port": 8080}, "tags": ["web", "api"]}. Note that debug comes out as the string "true", not a boolean.
Tips for a better result
- Keep each list item a plain value. A line like - name: x stays the literal string "name: x" instead of becoming an object.
- Remove inline comments after values, such as port: 80 # web, because the comment text becomes part of the value.
- Fix true, false and null by hand in the JSON output if your consumer needs real booleans or nulls.
Frequently asked questions
Does it support full YAML?
No. Anchors, aliases, multi-line strings with | or >, flow style like [a, b] or {a: 1}, multiple documents, and lists of objects are not handled. Use it for simple key-value and nested configs, and check complex files with a full YAML library.
Why did my version 1.10 become 1.1?
Values that match a plain number pattern are converted with Number(), and that drops trailing zeros. Wrap the value in quotes in the YAML, such as "1.10". The quotes are stripped, and the value stays a string.
Will invalid YAML show an error?
Usually not. The parser rarely fails. It produces output that may be wrong, for example when indentation is inconsistent. Compare the JSON against your expectations instead of relying on an error message.
What to check
A formatted or parsed result is not proof that code is secure, correct or production-ready. Never paste production secrets.
Read the Privacy Policy for information about local processing, connected services and advertising.