Find your next tool

Browse tools or search by task

Explore JSONToonPro

JSON Tools

YAML to JSON Converter Online – Convert YAML to JSON

Convert YAML to JSON online with support for nested maps and lists. Validate config structure and get clean JSON without uploading your data.

Runs locally in your browser. Nothing you paste is uploaded.

YAML to JSON workspace
34 nodes
Input/ YAML
295 chars20 lines
Output/ JSON
432 chars28 lines

How to Convert YAML to JSON

Paste YAML maps or lists and switch to YAML-to-JSON mode. Check the result before copying it. This tool uses a lightweight parser, so advanced YAML features should be checked with a full YAML implementation in your build pipeline.

YAML Maps and Lists in JSON

Indented key-value mappings become JSON objects and sequences become arrays. The converter must infer hierarchy from indentation. Mixed indentation or missing spaces after structural punctuation can lead to an unexpected shape.

YAML Data Types and Quoting

Quote identifiers, dates and values that must remain strings. Unquoted scalar interpretation varies across YAML parsers and versions. JSON cannot represent YAML-specific tags or arbitrary object types without an explicit mapping.

Common YAML Parse Errors

Inspect indentation first when a parse fails. Anchors, aliases, merge keys, complex keys and multi-document streams are not a guaranteed part of this lightweight converter’s support. Simplify a sample to isolate the failing construct.

YAML to JSON Examples

A list under users should become a JSON array under the users property. Comments are omitted because JSON has no comment syntax. Validate the produced JSON against the application’s schema before deployment.

More examples and technical details

Why Convert YAML to JSON

YAML is written by people. JSON is consumed by programs. Almost every reason to convert in this direction comes down to that split.

  • HTTP APIs overwhelmingly speak JSON. If your configuration lives in YAML but has to be posted to an endpoint, it has to be converted first.
  • JavaScript parses JSON natively and at speed. Loading YAML in a browser means shipping a parser library that is considerably larger than the config it reads.
  • JSON is unambiguous. There is one way to write a mapping and one way to write a list, so there is nothing to disagree about and no implicit typing to trip over.
  • Tooling is broader. Query languages, diff tools, schema validators, and log processors all assume JSON as a lowest common denominator.
  • Machine generated output should not be YAML. If nobody is going to read it, the readability advantage buys you nothing and the parsing cost is real.

Side by Side Example

A continuous integration workflow, converted to JSON. Notice what does not survive.

YAML input

# Nightly build pipeline
name: nightly
on:
schedule:
- cron: "0 2 * * *"
jobs:
build:
runs-on: ubuntu-latest # cheapest runner
steps:
- uses: actions/checkout@v4
- run: |
npm ci
npm test

JSON output

{
"name": "nightly",
"on": {
"schedule": [
{ "cron": "0 2 * * *" }
]
},
"jobs": {
"build": {
"runs-on": "ubuntu-latest",
"steps": [
{ "uses": "actions/checkout@v4" },
{ "run": "npm ci\nnpm test\n" }
]
}
}
}

Both comments are gone without a trace. The block scalar has been resolved into a single string with real newline escapes. The cron expression stayed a string because it was quoted in the source, which is exactly why it was quoted.

What YAML Features Cannot Survive

YAML featureFate in JSONPractical consequence
CommentsDropped entirelyRound tripping YAML through JSON destroys documentation
Anchors and aliasesExpanded into duplicated dataFile size grows, and the shared identity is lost
Merge keysResolved into literal keysOverrides are baked in and no longer traceable
Multi-document filesCannot be one JSON valueEmit a JSON array or separate files
Non-string keysIllegal in JSONKeys such as 1 or true are coerced to strings
Complex keysNo equivalentA mapping used as a key has to be restructured
Block scalar styleCollapsed to one stringThe pipe and fold distinction disappears once parsed
Explicit tagsIgnoredCustom types resolve to plain maps or strings
Trailing formatting and orderingNot guaranteedKey order preservation depends on the serialiser

Anchors expand, they do not link

One anchor used three times

defaults: &d { retries: 3, timeout: 30 }
a: *d
b: *d
 
becomes
 
{ "defaults": { "retries": 3, "timeout": 30 },
"a": { "retries": 3, "timeout": 30 },
"b": { "retries": 3, "timeout": 30 } }

The JSON is correct and the values are right, but the intent is gone. Change the retry count later and you now have three places to edit instead of one. This is why the YAML file should stay the source of truth and the JSON should be treated as a build artefact.

Multiple documents in one file

A line consisting of three hyphens starts a new document, and Kubernetes manifests use this constantly to put several resources in one file. JSON has no document separator, so a three document YAML file becomes either a JSON array of three objects or three separate files. Choose deliberately, because a consumer expecting a single object will fail on an array.

Type Coercion Differences

YAML resolves untagged scalars using pattern rules. JSON has explicit syntax and no inference at all. The conversion therefore locks in whatever the YAML parser decided, and the decision is invisible in the output.

YAML sourceParsed valueJSON output
version: 1.20Float1.2
version: "1.20"String"1.20"
enabled: yesBoolean under 1.1true
code: NOBoolean false under 1.1false
zip: 01234Octal or string, parser dependent668 or "01234"
value: ~Nullnull
blank:Nullnull
big: 12345678901234567890Integer beyond safe rangePrecision loss in JavaScript

YAML 1.1 Versus 1.2

The boolean rules changed between versions and most parsers did not follow. YAML 1.1 treats y, yes, on, true, n, no, off, and false as booleans in a range of casings. YAML 1.2 narrowed this dramatically, with the core schema recognising only true and false.

The catch is that many popular libraries still implement 1.1 semantics by default even though 1.2 was published in 2009. So the same file can convert differently depending on which language and which library you run it through, which is a genuinely unpleasant class of bug when a deployment pipeline and a local script disagree.

The defence is simple and costs nothing: quote any scalar whose string identity matters. Country codes, version numbers, times, zero padded ids, and single letter flags should all be quoted in the source. Then no parser has a decision to make.

Strict JSON is usually a stepping stone. Head to the full converter collection for JSON to YAML to return to a human friendly config, JSON Schema to validate the structure you just produced, and JSON to TypeScript to type it in application code.

Standards and references

Frequently asked questions

How do I convert YAML to JSON?

Paste a supported YAML mapping or list and select YAML-to-JSON mode.

How are YAML lists converted?

YAML sequences become JSON arrays, with maps inside the list becoming objects.

What happens to YAML comments?

Comments are omitted; JSON does not support them.

Why can YAML types be surprising?

Unquoted scalars may be interpreted as numbers or booleans, and YAML versions differ. Quote values that must remain strings.

Is my YAML uploaded?

No. Input is processed in this browser tab and is not uploaded by the tool. Copy and download are actions you control; ordinary page analytics do not receive tool input.