YAML to JSON converter
Paste YAML and get formatted JSON as you type. Anchors and merge keys are expanded, comments are dropped, and everything runs in your browser.
How to convert YAML to JSON
- Paste a YAML document, such as a Kubernetes manifest, Docker Compose file, or CI workflow, into the input panel.
- The JSON output updates as you type. Syntax errors show the line and column the parser stopped at.
- Choose 2- or 4-space indentation, or minify the JSON to a single line for an API payload or environment variable.
- Copy the JSON or download it as a
.jsonfile.
For example, the YAML list queues: [emails, exports] under a worker key becomes:
{
"worker": {
"queues": ["emails", "exports"]
}
}What changes between YAML and JSON
YAML 1.2 is a superset of JSON, so every YAML value has a JSON equivalent, but a few YAML features only exist in the source file. Comments are dropped. Anchors, aliases, and merge keys are replaced by the values they point to, so repeated blocks appear in full. Block scalars (| and >) become ordinary strings, with | keeping line breaks and > folding them into spaces.
Key order is preserved, and multi-document files separated by --- become a JSON array with one element per document.
When to convert YAML to JSON
- Sending a YAML config to an API or tool that only accepts JSON
- Inspecting a Helm or Kubernetes manifest with
jqor a JSON viewer - Checking how anchors and merge keys in a Compose or CI file actually expand
- Validating a YAML document against a JSON Schema
- Storing configuration in a database column or warehouse table that expects JSON
From config files to answers
If your YAML ends up in a database or warehouse, Basedash lets you ask questions about it in plain English. It writes the SQL, runs it, and returns a chart or dashboard, and it connects to PostgreSQL, MySQL, BigQuery, Snowflake, and 750+ other data sources.
FAQ
How do I convert YAML to JSON?
Paste your YAML into the input panel and the JSON output appears as you type, with no upload or button press. Pick 2- or 4-space indentation, or minify the output to a single line, then copy the result. If the YAML has a syntax error, the converter shows the parser's message with the line and column so you can fix it.
What happens to YAML comments when converting to JSON?
They are removed. JSON has no comment syntax, so lines and trailing text that start with # are dropped during parsing. Everything else, including keys, values, nesting, and list order, is kept. If you need to keep notes alongside the data, move them into a regular field such as "description" before converting.
Does the converter resolve YAML anchors, aliases, and merge keys?
Yes. Anchors (&name), aliases (*name), and merge keys (<<: *name) are expanded during parsing, so the JSON output contains the full values at every place they are referenced. Keys set after a merge key override the merged values, which matches how Docker Compose, GitHub Actions, and most YAML tooling read the same file.
Can I convert a YAML file with multiple documents?
Yes. When the input contains several documents separated by --- lines, as Kubernetes manifests often do, the converter outputs a JSON array with one element per document, in order. A file with a single document converts to that document's JSON value directly, without a wrapping array.
How are YAML types like dates, booleans, and numbers converted?
The converter uses the YAML 1.2 core schema. Unquoted true and false become JSON booleans, numbers become JSON numbers, null and ~ become null, and timestamps are output as ISO 8601 strings. Values like yes, no, on, and off stay strings, because YAML 1.2 no longer treats them as booleans. Quote any value you want kept as a string.
Is my YAML uploaded to a server?
No. Parsing and formatting run entirely in your browser with JavaScript, so your configuration files, secrets, and manifests never leave your machine. Nothing is logged or stored, and the page keeps working offline once it has loaded.
Skip the conversion and ask your data
Connect your data and describe what you want to see. Basedash handles the query, visualization, and dashboard.