Skip to content
brownie.tools

YAML to JSON Converter

Choose YAML scalar rules, inspect type changes, and export single or multi-document JSON locally.

Multiple YAML documents become a JSON array. Input limit: 2 MiB. Anchors and tags are unsupported.

Runs locally in your browser. Nothing is uploaded or sent to a server.

Paste YAML or open a local file to convert it to JSON. Multiple documents become an array. Choose YAML 1.2 core or YAML 1.1 compatible scalar inference and inspect inferred numbers, booleans, nulls, and dates in the Type changes panel. Inline collections, nested mappings, sequences, and block strings are supported. Choose minified, 2-space, or 4-space output, then copy or download. Conversion runs in your browser with a 2 MiB input safety limit; unsupported syntax and duplicate keys produce errors.

Updated

What Does a YAML to JSON Conversion Look Like?

Paste this configuration into YAML Input with Schema set to YAML 1.2 core and JSON indent set to 2 spaces. JSON Output appears automatically. The example combines a quoted identifier, an unquoted number, a boolean, an inline array, and a literal string. It demonstrates why reviewing the resulting values matters as much as checking the brackets.

service: report-worker
version: "1.10"
retries: 3
enabled: true
ports: [8080, 8443]
script: |-
  echo ready
  echo done

The resulting JSON is:

{
  "service": "report-worker",
  "version": "1.10",
  "retries": 3,
  "enabled": true,
  "ports": [
    8080,
    8443
  ],
  "script": "echo ready\necho done"
}

The quotes preserve the version as text, including its final zero. Removing them converts 1.10 to the number 1.1. The |- indicator preserves the line break between commands and removes trailing newlines; JSON displays that break as \n. Type changes identifies inferred scalar values by path, such as $.retries and $.ports[0]. Quoted strings do not appear as type changes.

How Do You Convert YAML Files to JSON?

Open a local YAML file or paste configuration text into the input. The converter updates the JSON result as you edit, so there is no separate conversion step. Choose an indentation setting and use Copy or Download JSON to move the result into your project. File contents are processed in the browser. Opening a file does not require an account or an upload endpoint.

The file workflow preserves a useful output name: opening settings.yml produces a download named settings.json. If clipboard access is blocked by browser permissions, paste directly into the input instead. Sample provides a two-document configuration for exploring the controls. Clear removes the input and its result; it does not modify the file you originally opened.

How Are Multi-Document YAML Streams Represented in JSON?

YAML streams can contain several independent documents separated by ---. JSON has one root value, so this converter represents a stream with multiple documents as an array. The first document becomes the first array element, and the remaining documents follow in order. This is useful when a deployment file contains several resource definitions or when a test fixture stores several examples together. The combined array is an export format; confirm that the application receiving it expects an array before using it as configuration.

A single YAML mapping remains a JSON object. A single YAML sequence remains a JSON array, and a single scalar remains its corresponding JSON value. An explicitly empty document becomes null. The ... document end marker is accepted. After an end marker, a new document must begin with ---. Separators must appear at the beginning of the line; an indented separator inside a block string is preserved as text.

Which Inline Collections and Strings Can You Convert?

Single-line flow collections such as ports: [80, 443] and metadata: {region: eu, active: true} become JSON arrays and objects. Collections can nest, and quoted commas or colons remain inside their strings. Empty collections become [] and {}. For longer structures, use indented block mappings and sequences instead of spreading a flow collection across lines.

Comments outside quoted strings are removed when the hash begins a YAML comment. A hash embedded in a plain URL fragment remains part of the value, and "#ffffff" remains a string. Single-quoted text supports doubled apostrophes. Double-quoted text accepts JSON-compatible escapes such as \n, \t, and \u0041. Unsupported escape sequences produce errors. Literal blocks use |, folded blocks use >, and the basic - and + chomping indicators control trailing newlines.

How Do You Avoid Accidental Type Changes?

Quote values that must remain strings. In the default YAML 1.2 core mode, yes, no, on, off, and dates remain strings. YAML 1.1 compatible mode converts these words to booleans and supported dates and timestamps to UTC ISO strings. Both modes convert decimal, exponent, 0o octal, and hexadecimal notation to numbers; compatible mode also recognizes leading-zero octal integers and base-60 numbers. Quote account numbers, identifiers with leading zeros, or large integers when their exact textual representation matters.

JSON does not represent Infinity or NaN. Rather than silently substituting null, the converter reports an error for these values. Integers outside JavaScript's safe range are rejected as well. Duplicate mapping keys are errors because overwriting a prior value could hide a configuration mistake. These checks help make the downloaded result explicit and reviewable.

Which Values Change When You Switch Schema?

The Schema selector controls scalar inference, not full specification support. The following comparison applies to unquoted values. Quoting any of these tokens keeps it a string in either mode. Switching schemas recalculates both JSON Output and Type changes from the same input; compare them before copying configuration into an application with different YAML parsing rules.

Unquoted scalar values under the two available schema modes
YAML valueYAML 1.2 core outputYAML 1.1 compatible output
yes"yes"true
OFF"OFF"false
010108
0o1088
1:30"1:30"90
~nullnull

An empty mapping value also becomes null. Compatible date inference accepts a supported calendar date or timestamp; timestamps without an explicit timezone are interpreted in UTC. Dates serialize as ISO strings because JSON has no date type. This mode does not add support for anchors or tags.

What Limits and Unsupported Features Should You Check?

Inputs are limited to 2 MiB (2,097,152 bytes) of UTF-8 data, and nesting is bounded. These safeguards apply to pasted text and local files. Large streams can be split into smaller groups of documents before conversion. Non-ASCII characters can occupy multiple bytes, so a character count is not a file-size check. Browser memory and processing speed still affect the experience; a byte limit is not a guarantee that every deeply nested input will convert quickly.

This is a subset converter, not a full YAML specification implementation. Anchors, aliases, merge keys, tags, directives, complex mapping keys, and multiline quoted or flow values are unsupported. Use spaces for indentation. Errors replace the current JSON output instead of leaving a partial conversion ready to download. After exporting, use the JSON validator to inspect JSON syntax or the JSON formatter for further inspection. Converting back through the JSON to YAML converter does not restore comments, original quote styles, or document separators because JSON does not retain that formatting.

What Should You Check Before Using the Export?

Check the document count beneath JSON Output before treating the result as a configuration object. The status also reports output lines and bytes; selecting Minified reduces formatting whitespace. A successful conversion checks the supported YAML syntax, not your application's required fields or configuration schema. Review string identifiers and nulls, confirm whether the receiving system expects an object or an array, and keep the original YAML if its comments are useful documentation.

How to Use YAML to JSON Converter

  1. YAML Input

    Enter YAML directly, select Paste, or select Open file to read a local file up to 2 MiB. Sample loads a two-document example. Conversion updates as you edit.

  2. Schema

    Choose YAML 1.2 core or YAML 1.1 compatible. Review Type changes to see inferred values and their paths before exporting.

  3. JSON indent

    Choose Minified, 2 spaces, or 4 spaces. The default is 2 spaces; this setting changes formatting without changing values.

  4. Download JSON

    Review JSON Output and resolve any YAML Error. Copy the result or select Download JSON. Opening config.yaml gives config.json; pasted input uses output.json.

Frequently Asked Questions