YAML to JSON Converter

Convert YAML to JSON and JSON to YAML instantly. Supports nested objects, arrays, multi-line strings. Free, browser-based, no server required.

  • Runs in your browser
  • Your data never leaves your browser
  • Free · No Sign-Up
Clears both panes, the status and pending conversion. Ctrl+L (⌘+L on Mac) does the same while focus is inside this tool.
Paste one YAML document here. After 0.3 seconds without typing, the JSON pane updates with two-space indentation. Values JSON cannot preserve stop conversion and are listed by field path.
Copies all current text in the YAML pane, including your edits. An empty pane cannot be copied.
Paste JSON here. After 0.3 seconds without typing, the YAML pane updates with two-space indentation. Long lines are not folded.
Copies all current text in the JSON pane, including your edits. An empty pane cannot be copied.
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

Worked Examples

Simple object

Input YAML:

name: Alice
age: 30
active: true

Output JSON (indented with 2 spaces):

{
  "name": "Alice",
  "age": 30,
  "active": true
}

30 stays a number and true a boolean, because plain YAML scalars are typed by their form.

Nested structure with arrays

Input YAML:

server:
  host: localhost
  port: 8080
  features:
    - auth
    - logging
    - cache

Output JSON:

{
  "server": {
    "host": "localhost",
    "port": 8080,
    "features": [
      "auth",
      "logging",
      "cache"
    ]
  }
}

JSON to YAML

Input JSON:

{"name":"api","version":"1.10","replicas":3,"env":{"DEBUG":"no","PORT":"8080"},"args":["--verbose","--port=8080"],"description":"line one\nline two","empty":null}

Output YAML:

name: api
version: '1.10'
replicas: 3
env:
  DEBUG: 'no'
  PORT: '8080'
args:
  - '--verbose'
  - '--port=8080'
description: |-
  line one
  line two
empty: null

Strings that would read back as another type (‘1.10’, ‘no’, ‘8080’) or that start with - are single-quoted. A string with a line break becomes a |- block, and long lines are never folded. This matters for files such as Kubernetes manifests, where an environment value must stay a string.

Anchors and merge keys

Docker Compose files often share settings with an anchor and <<:

base: &base
  image: nginx
  restart: always
web:
  <<: *base
  ports: ["80:80"]

The JSON output has no references: web becomes {"image":"nginx","restart":"always","ports":["80:80"]}, a full copy of base plus its own key, and the base entry stays in the output as well.

Round-trip conversion

Paste the JSON output back into the JSON panel and wait 0.3 seconds for the YAML panel to update. Note that YAML comments and formatting preferences are not preserved in round-trips.

YAML vs JSON

YAML (YAML Ain’t Markup Language) is a human-friendly data serialization format popular for configuration files (Docker Compose, Kubernetes, Ansible, GitHub Actions). JSON (JavaScript Object Notation) is the most widely used data interchange format for APIs and web services. Both can represent the same data structures — this tool converts between them. Comments, anchors, and some scalar values change on the way; see “Values That Change Type” below.

Values That Change Type

The tool uses js-yaml 4.3.2, which follows the YAML 1.2 core schema plus timestamps. These inputs convert as shown:

YAMLJSONNote
country: NO"NO"String. YAML 1.1 parsers such as PyYAML read it as false
enabled: yes"yes"Same as above; write true for a boolean
version: 1.101.1Parsed as a number; quote version strings
mode: 0755755A leading zero is not octal in YAML 1.2; write 0o755
zip: 012341234The leading zero is lost; quote codes like this
date: 2026-09-29"2026-09-29T00:00:00.000Z"Dates become full UTC timestamps
at: 2026-10-01T09:30:00+09:00"2026-10-01T00:30:00.000Z"Offsets become UTC. JSON has no date type, so the text is ISO 8601 in UTC: the same instant, but the written +09:00 is not kept
zero: -0.0-0.0Negative zero keeps its sign (JSON.stringify alone would write 0)
empty:nullA key with no value is null

Limits

  • One document per conversion. Input containing --- separators fails with expected a single document in the stream, but found more.

  • Values JSON or YAML cannot hold stop the conversion. YAML .inf, -.inf and .nan, and integers outside ±(2^53 − 1) on either side, would change on the way (JSON.stringify writes null; JSON.parse and js-yaml round large integers). The status line lists each field as a JSON Pointer. This YAML:

    size: .inf
    id: 9007199254740993

    gives Not converted: JSON cannot hold these values without changing them: /size: inf has no JSON form (JSON.stringify would write null); /id: integer 9007199254740993 is outside ±(2^53 − 1), so JavaScript would round it. A JSON number too large for a double, such as 1e400, is listed the same way. Quote large IDs. The output panel is cleared and its Copy button is disabled until the input converts.

  • Dates must be real, and times stop at milliseconds. js-yaml builds dates with Date.UTC, which moves 2026-02-31 to March 3, and keeps only milliseconds. Such timestamps stop the conversion instead. This YAML:

    due: 2026-02-31
    at: 2026-10-01T09:30:00.123456Z

    gives Not converted: JSON cannot hold these values without changing them: /due: 2026-02-31 is not a valid date or time; /at: 2026-10-01T09:30:00.123456Z has more than millisecond precision. Quote a value that is meant as text (due: "2026-02-31"). Valid dates and times convert to UTC as shown in the table above.

  • js-yaml work limits. js-yaml 4.3.2 stops a document whose collections are nested more than 100 levels deep, whose merge keys (<<) handle more than 10,000 mappings and keys in total, or that lists more than 100 mappings in one merge key, for example Invalid YAML: collections are nested more than 100 levels deep (the js-yaml default limit) (1:103).

  • Duplicate keys are an error (duplicated mapping key), not a silent overwrite.

  • Errors show line and column. A key indented one space too far gives Invalid YAML: bad indentation of a mapping entry (2:3) with the offending line marked; an unclosed [ gives unexpected end of the stream within a flow collection. To check a file with several --- documents, use the YAML Validator, which reports each document separately.

  • Comments and anchors are not kept. Anchors and << merge keys are expanded into plain copies.

  • The JSON integer -0 becomes 0. {"count":-0,"offset":-0.0} gives count: 0 and offset: -0.0: YAML 1.2 reads -0 as the integer zero, and -0.0 stays the negative float zero.

  • JSON → YAML quotes ambiguous strings such as '1.10', 'yes', and 'NO', so they stay strings when read back.

FAQ

What YAML features are supported?

All standard YAML 1.2 features including nested objects, arrays, multi-line strings (literal and folded), anchors, aliases, and all scalar types (strings, numbers, booleans, null, dates).

Can I convert multi-document YAML?

No. Input with several documents separated by --- shows the error 'expected a single document in the stream, but found more'. Convert one document at a time, or check the file with the YAML Validator, which reports each document separately.

How are YAML data types mapped to JSON?

YAML strings become JSON strings, numbers stay numbers, booleans become true/false, null becomes null, dates become ISO strings, and sequences/mappings become arrays/objects. .inf, .nan, integers outside ±(2^53 − 1), impossible dates such as 2026-02-31 and times finer than milliseconds cannot be written to JSON unchanged, so the conversion stops and names those fields.

Is my data sent anywhere?

No. All conversion runs in your browser using JavaScript. Your data never leaves your machine.