YAML to JSON Converter – Free, Online, Private
Parse YAML and print strict JSON. Handy for checking a config file before an API that only accepts JSON, or for stripping comments.
How to convert YAML to JSON
- Paste one YAML document. Indentation is significant, so keep the spaces you copied.
- The page loads it with js-yaml and prints JSON with two-space indentation.
- Copy the JSON. Comments and anchors are resolved or dropped, because JSON has neither.
Why the reverse direction is stricter
YAML allows comments, several documents in one stream, unquoted strings, and implicit types. JSON allows none of that. This converter reads a single YAML value and serializes it with JSON.stringify. Comments disappear. A value that YAML read as a boolean stays a boolean. Dates that js-yaml turns into Date objects become ISO strings, which is the usual surprise: an unquoted 2026-10-16 can stop being a string. Quote it in the YAML if you need a string in the JSON.
Indentation and tabs
YAML indentation must be spaces. A tab used for indent is an error in the spec and this page reports it. Nested maps line up under their parent. A sequence item's content can sit on the dash line or on the next line. If you copied from a browser and the indent collapsed, the error position from the parser is the place to look. Mixed indent widths in one file are legal as long as each level is consistent, but they are a common source of "bad indentation" errors.
Multi-document streams
A file that contains two YAML documents separated by --- is not one JSON value. This converter reads the first document. Split the file if you need both. Directives such as %YAML 1.1 are ignored by the loader when they are not needed. Custom tags such as !!python/object are not executed; unsafe types are rejected rather than turned into objects. That is intentional. Do not use this page as a YAML sandbox for untrusted tags.
Worked example
The sample is one YAML map: id 42, name Ada Lovelace, active true, a tags sequence of math and engines, and an address map with city London and zip SW1A. The JSON result is one object, not a list of documents. tags becomes a JSON array of two strings. address becomes a nested object with city and zip, not a dotted key. An unquoted yes added beside active would become boolean true, which is the YAML typing trap this page is about. A comment above id disappears, because the JSON form has nowhere to put it. That is a different result from the JSON-to-YAML page, which starts from braces and never had a comment to drop.
Typical uses
Developers paste a Kubernetes manifest fragment to see the exact JSON a controller would store. Others convert an OpenAPI example written in YAML before posting it to an endpoint. Because the work stays on device, private hostnames and secrets in the file are not logged by this site. After conversion, the JSON formatter on Utilo can minify or query the result.
Frequently asked questions
Are YAML comments kept?
No. JSON has no comment syntax, so comments are discarded while parsing. If you need them, keep the YAML.
What happens to dates?
Unquoted ISO dates may become strings after a Date round trip. Quote the scalar in YAML when the consumer must see the original characters.
Can I convert Helm templates?
Only after rendering. {{ }} actions are not YAML. Render the chart, then paste the result.
Is the loader safe against YAML bombs?
Huge alias expansions can still use memory in your own browser tab. The page does not send the document anywhere. Avoid untrusted files with thousands of anchors.