JSON to YAML Converter

Validate JSON and preserve objects, arrays, strings, numbers, booleans, and nulls as downloadable YAML—parsed and generated locally in your browser.

JSON Input

1 line · 0 bytesWaiting for input
Drop a .json file here

No file selected.

Browser-side file limit: 2 MB. Automatic conversion pauses above 500 KB.

Output settings

Spaces per nesting level (2–8).

Flow style renders every array and object inline with [] and {}.

Long foldable YAML strings may wrap at this width.

Used when a YAML string needs or is forced to use quotes.

Use Tab to indent and Ctrl/Cmd + Enter to convert. Matching brackets are highlighted at the caret.

YAML Output

1 line · 0 bytesYAML

Advertisement

About this JSON to YAML converter

  1. Paste JSON, open a .json file up to 2 MB, or drop a file into the JSON input editor.
  2. Review any line-and-column validation message and optionally choose indentation, block or flow style, wrapping, quotes, key sorting, or null removal.
  3. Leave automatic conversion on or select Convert JSON to YAML.
  4. Copy the YAML or download converted.yaml.

The direction switch supports an explicit YAML-to-JSON workflow without guessing the input format; use Swap input and output to reverse both the formats and current contents.

Parsing and output generation happen in your browser. Document contents are not submitted for conversion. The converter uses js-yaml 4.1.0, served from a same-origin local site asset rather than fetched from a third-party origin. Last tested and updated: .

JSON to YAML examples

Select an example to load both formats. In the default direction it loads JSON input and YAML output; in reverse it loads YAML input and JSON output.

Nested object and array

Convert project metadata, flags, and a list of owners.

{ "project": { "owners": ["Ada", "Lin"] } }

project:
  owners:
    - Ada
    - Lin

Kubernetes / Helm values

Turn deployment image and service settings into values YAML.

{ "replicaCount": 3, "image": { "repository": "nginx" } }

replicaCount: 3
image:
  repository: nginx

OpenAPI / Swagger

Convert a small OpenAPI path and response definition.

{ "openapi": "3.0.3", "paths": { "/health": {} } }

openapi: 3.0.3
paths:
  /health: {}

Scalar edge cases

Inspect nulls, booleans, numeric-looking strings, multiline text, and special characters.

{ "empty": null, "code": "0012", "enabled": false }

empty: null
code: '0012'
enabled: false

What is preserved and what can change?

JSON / YAML concernConversion behavior
Nested data and scalar typesObjects, arrays, strings, numbers, booleans, and nulls are preserved unless you enable a data-changing option.
Indentation and quotesYAML uses indentation for nesting. js-yaml adds quotes automatically when a plain scalar could be ambiguous; quote preferences affect strings that are quoted.
Key orderKeys normally follow JavaScript enumeration order. Sorting deliberately changes the order, and integer-like keys can follow JavaScript ordering rules.
NumbersJavaScript number parsing can lose precision outside ±9007199254740991. Quote large identifiers or exact digit sequences.
YAML-only featuresJSON cannot carry comments, anchors, aliases, tags, presentation choices, or multiple documents. YAML-to-JSON resolves data and discards those features; multiple documents are rejected.

JSON to YAML converter FAQ

Why is my JSON invalid, and are trailing commas allowed?

JSON requires double-quoted keys and strings and does not allow trailing commas, comments, undefined, or functions. The editor reports the detected line, column, and nearby token so you can correct the source without losing it.

Are my JSON or YAML document contents uploaded?

No. Parsing and output generation run in this browser with js-yaml 4.1.0, and document contents are not submitted for conversion. The page and its same-origin dependency still have to be loaded normally.

Is JSON key order preserved?

By default, object keys are emitted in JavaScript enumeration order, which normally follows the parsed JSON order. Turning on Sort object keys deliberately changes that order, and integer-like keys may follow JavaScript ordering rules.

Is the output YAML 1.2 compatible?

The converter uses js-yaml 4.1.0 and emits YAML supported by that library. JSON scalar values map cleanly to common YAML 1.2 types, but this tool is not a full YAML specification conformance checker.

How are strings quoted in YAML?

js-yaml automatically quotes strings when plain text would be ambiguous. You can prefer single or double quotes and force quotes for non-key strings; multiline text may still use YAML block scalar syntax when appropriate.

Are YAML comments, anchors, aliases, tags, or multiple documents preserved?

No. JSON has no equivalent for those YAML features. YAML to JSON parses one YAML document into data, so comments and presentation details are discarded, aliases are resolved, and multiple documents are rejected.

What does Remove null values do?

It recursively removes null-valued object properties and null array items before output. This changes the data rather than only formatting it, so the option is off by default.

Are large integers preserved exactly?

Not always. Parsing uses JavaScript numbers, so integers outside the safe range of minus 9,007,199,254,740,991 to plus 9,007,199,254,740,991 can lose precision. Quote identifiers and large integer-like values when exact digits matter.

What file sizes are supported?

The visible file picker and drag-and-drop importer accept one .json, .yaml, or .yml file up to 2 MB. Automatic conversion pauses above 500 KB; use the Convert button for those larger documents.

Does the converter work offline?

Conversion makes no document-content request once the page and its same-origin js-yaml file are available. It can keep working in an already loaded tab, but a fresh offline visit depends on whether your browser has cached the page assets.

Explore more tools