On-device AI — professional-grade, fully private.

JSON to YAML Converter

JSON to YAML with quoting that survives every parser

  • No upload
  • Round-trip verified
  • PyYAML-safe quoting

Drop a JSON file here

JSON, NDJSON or JSON Lines, up to 10.0 MB

Output
Target parser
Target parser

Portable quotes the values a YAML 1.1 or timestamp-aware parser would read as a different type.

Layout
2 spaces
Null style

Reads the YAML back with an independent parser and compares it to your JSON.

Output styling
Quote style
0 (off)
Pro

Free: 1 file, up to 10.0 MB. Pro: up to 50 files and one ZIP.

How to convert JSON to YAML

  1. 1

    Paste or upload JSON

    Paste JSON into the editor, or drop a .json, .ndjson or .jsonl file onto the page. Nothing is uploaded — the file is read on your device.

  2. 2

    Choose the target parser

    Portable is the default and quotes every value that a YAML 1.1 or timestamp-resolving parser would read as a different type. Pick YAML 1.2 for minimal quoting, or quote every string when the consumer is unknown.

  3. 3

    Set the layout

    Choose the indent, how nulls are written, and whether the document starts with ---. The preview updates as you change each one.

  4. 4

    Convert and check the result

    Press Convert to YAML. The result is read back with an independent parser and compared to your original JSON, and the badge says whether every value survived.

  5. 5

    Download or copy

    Download the .yaml file or copy it to the clipboard. Use the YAML to JSON tool for the reverse.

What this JSON to YAML tool offers

This free converter turns JSON into YAML on your device. Paste or upload JSON, pick the parser your YAML is written for, and the converter quotes exactly the values that would otherwise change type on the way out. Every result is read back with an independent parser and compared against your original JSON before it is offered to you. Invalid JSON is located to the character, with a caret and a route out.

  • Quoting for a named parser — Choose YAML 1.2, portable, or quote every string. Portable is the default and is safe under PyYAML, js-yaml, Ruby Psych and Go.
  • Round-trip verification — The YAML is re-read with an independent parser and compared value by value to your JSON. The badge names the first path that differs if any does.
  • Readable multi-line strings — A string containing newlines is written as a block literal, so scripts, certificates and SQL stay readable instead of collapsing into escapes.
  • NDJSON in, multi-document YAML out — One JSON value per line becomes one YAML document per line of input, separated by ---. Blank lines are skipped.
  • Errors located on your device — Message, line, column, a caret under the exact character and what was expected there — identical in every browser rather than whatever the browser's own parser reports.
  • Runs on your device, not our servers — The file is read, parsed, converted and verified locally. There is no upload step, so there is nothing to opt out of.

Which parser will read your YAML?

This is the setting that decides whether the conversion is correct, and it is the reason this tool exists. YAML has no single agreed way to read an unquoted word: the same file means different things to different parsers, and a converter that writes minimal quotes is betting on which one you will use.

  • Portable (default) — Quotes the union of everything a YAML 1.2 core parser, a YAML 1.1 parser and a timestamp-resolving parser would re-type. Slightly more quotes; the same values everywhere.
  • YAML 1.2 — Minimal quoting, matching the YAML 1.2 core schema. Correct if — and only if — whatever reads the file is a 1.2 parser with no timestamp resolution. The tool still counts and reports the values a 1.1 reader would change.
  • Quote every string — Every string scalar is quoted. Verbose, unambiguous, and the right answer when you have no idea what will read the file.
  • Who reads YAML 1.1 — PyYAML and therefore Ansible and SaltStack, Ruby's Psych, and a long tail of tooling built on them. It is not a legacy corner; it is most of the infrastructure world.

The values YAML quietly changes

These are not exotic strings. They are the ones people actually store in configuration files, and each one comes back as a different type from a parser that has not been told otherwise. Portable mode quotes all of them; YAML 1.2 mode quotes only the first row and tells you how many of the rest it left alone.

  • true, false, null, 12, 1.5, 0x1F — Re-typed by every parser, including YAML 1.2. Always quoted, in every mode.
  • yes, no, on, off, y, n — Strings under YAML 1.2. Booleans under YAML 1.1 — so a config value of "no" becomes false in Ansible.
  • 0755, 0644 — A file permission, and a leading-zero octal integer to a YAML 1.1 parser: 0755 becomes 493.
  • 1:30, 12:30:45 — A duration or a timestamp to you; base-60 integers to a YAML 1.1 parser, which reads 1:30 as 90.
  • 2024-01-01 — A date object to anything with timestamp resolution, including js-yaml's default schema, PyYAML and Go's yaml.v3.
  • 1_000, 0b1010 — Strings by the letter of the 1.2 specification, integers to js-yaml. Quoted anyway, because the reader is what matters and not the specification.

How JSON types become YAML

The mapping is direct and the structure of your document is preserved exactly. Nothing is reordered, nothing is dropped, and no key is renamed.

  • Objects — Indented key-value blocks. Key order is preserved unless you ask for sorted keys.
  • Arrays — Dash-prefixed lists. A list inside a mapping can be indented or sit at the key's column.
  • Empty object and empty array — Written {} and [] rather than left blank, because a blank value reads back as null and would silently change the shape.
  • null — Written null by default, or as a tilde, or left empty. The empty form is used for mapping values only — see the note on layout below.
  • Strings with newlines — Block literals, with the chomping indicator chosen from the trailing newlines so the string round-trips exactly.
  • Keys — Quoted by the same rules as values. A key of "n" or "yes" is quoted, because an unquoted one becomes a boolean key in a YAML 1.1 reader.

Multi-line strings and long values

A shell script inside a config map, a PEM certificate, a SQL statement — these are the values people most want to stay readable, and the ones a naive converter mangles into a single line of escapes.

  • Block literals — A multi-line string is written after a | so the lines stay lines. The chomping indicator is chosen from the trailing newlines, so none are gained or lost.
  • When a block cannot be used — A string whose first line is blank or indented, or that contains a carriage return or a control character, is quoted instead. Those cases need an explicit indentation indicator and getting one wrong is silent corruption.
  • Wrapping long lines (Pro) — A wrap column folds long values with an escaped line break, which is the only wrapping form in YAML that is exactly reversible. Folded plain and folded block scalars are not, so a value that needs wrapping is quoted first.
  • No accidental folding — With wrapping off — the default — long strings stay on one line rather than being folded, so nothing is reflowed on the way out.

NDJSON and multi-document YAML

NDJSON — also called JSON Lines — is one JSON value per line, and it is what log pipelines, database exports and jq -c produce. It is not valid JSON as a whole file, so most converters reject it.

  • Detected two ways — By a .ndjson or .jsonl extension, and by content: a file that is not a single valid JSON document but whose non-blank lines each parse on their own.
  • One document per record — Each value becomes its own YAML document, separated by ---, which is how a YAML stream is read back by every parser.
  • A single-line array is not NDJSON — [1,2] is a valid JSON document, so it is converted as one. The single-document read is tried first for exactly this reason.
  • A bad line stops the conversion — The line number is reported rather than producing a partly converted stream with silently dropped records.

Layout and formatting options

None of these changes what the document means. All of them change how it reads, and the preview updates as you move each one.

  • Indent — 1 to 8 spaces per nesting level. Two is the default and what most YAML tooling expects.
  • Null style — null, a tilde, or empty. The empty form is used for mapping values only: an empty sequence entry at the end of a nested list is read differently by different parsers, so it is written as a tilde there.
  • Document marker — Start the file with ---. Always emitted between documents in a multi-document stream, whatever this is set to.
  • Sort keys (Pro) — Alphabetical keys, for diffs that do not move when a producer reorders its output.
  • Quote style (Pro) — Single or double quotes where quoting is needed. Single quotes fall back to double for any string they cannot represent.
  • Sequence indentation (Pro) — Indent a list under its key, or sit it at the key's column — the house style of Kubernetes manifests, and four fewer columns on every list.
  • Multi-line style (Pro) — Readable block literals, or a single escaped double-quoted line.

Round-trip verification

Every other converter in this category hands you YAML and leaves you to find out later whether it still means what your JSON meant. This one checks, before you download anything.

  • An independent reader — The result is parsed by a different implementation from the one that wrote it. A writer checked by its own reader proves nothing — the two would share any misunderstanding.
  • Compared value by value — Against your original JSON, not against a re-serialised copy of it. Types are compared as well as values, so a string that came back as a date fails.
  • The first difference is named — By path — /servers/3/started — with both types and both values, rather than a bare "verification failed" on a 40,000-line file.
  • Read against the parser you chose — Verification uses the schema matching your target, so verified always means verified for the reader you said you were writing for.
  • It can be turned off — It costs a second read of the document. On a large file with a known-good shape you may not want it; the setting is yours and the result is marked stale if you change it.

Powered by optimised processing algorithms.

Why convert JSON to YAML?

YAML is the configuration format of the infrastructure world, and JSON is what almost everything emits. Converting between them is how data from an API, a database or an application ends up in a Kubernetes manifest, a Compose file, a GitHub Actions workflow or an Ansible playbook.

  • Config workflows — Reuse JSON-shaped data in Kubernetes, Docker Compose, GitHub Actions, Ansible and anything else that reads YAML.
  • Readability — YAML drops the braces and quotes, so a nested document is easier to read and to review in a pull request.
  • Comments — YAML supports comments and JSON does not, so converting is often the first step in turning generated data into something a human will maintain.
  • Correctness matters more here — A config file is executed. A version string that becomes a number, or a permission that becomes octal, does not fail loudly — it deploys.
  • Privacy — It all runs on your device, not our servers, so an API response containing credentials or customer data is never uploaded.

Frequently asked questions

How does this JSON to YAML converter work?

Paste JSON or drop a .json file, choose the parser you are writing for, and press Convert to YAML. Your JSON is parsed and re-written as YAML on your device — objects become key-value blocks, arrays become dash-prefixed lists, and multi-line strings become readable block literals. You can then copy the result or download it as a .yaml file.

Is my JSON data secure?

Yes. The file is read and converted on your device and nothing is sent anywhere, stored or logged. After the page loads you can work offline, which makes the tool safe for private configs, secrets, or proprietary payloads. There is no upload step to opt out of, because there is no upload.

Why does the converter quote 2024-01-01 and yes?

Because a YAML parser would otherwise not give you back a string. Under YAML 1.1 — which PyYAML, Ansible and Ruby Psych still use — yes, no, on and off are booleans, 0755 is the number 493, and 1:30 is the number 90. Under any parser with timestamp resolution, including js-yaml's default schema, 2024-01-01 is a date object. The Portable target quotes exactly those values and nothing else, so what you put in is what a reader gets out.

What is round-trip verification?

After the YAML is written it is read back with an independent parser and compared against your original JSON, value by value. The badge says verified when every value matched, and names the first path that differs when one did not — for example /servers/3/started, string against date. No other online JSON to YAML converter checks its own output.

How are JSON data types mapped to YAML?

Strings, numbers, booleans and null carry over directly. Objects become indented key-value blocks and arrays become dash-prefixed lists, so the structure of your original JSON is preserved exactly. An empty object is written {} and an empty array [], because a blank value would read back as null. Strings containing newlines become block literals, which stay readable instead of being escaped onto one line.

Can I convert NDJSON or JSON Lines?

Yes. A .ndjson or .jsonl file — one JSON value per line, which is what most log pipelines and database exports produce — becomes a multi-document YAML stream, with each document separated by ---. Blank lines are skipped. A file that is not named .ndjson is checked too, so a JSON Lines file with a .json name still converts correctly.

Can I change indentation, and what if my JSON is invalid?

Indentation is adjustable from 1 to 8 spaces and affects readability only — the data is unchanged. If the JSON cannot be parsed, the tool shows the message, the line and column, a caret under the exact character and what was expected there, with links to the JSON Formatter and Validator. That location is worked out on your device, so it is identical in every browser rather than depending on what your browser's parser happens to report.

Is it free, and does it work on mobile and offline?

Yes. Files up to 10 MB convert free, and every setting that decides whether the output is correct — the target parser, the indent, the null style, the document marker and the verification — is free. It runs in any modern browser including phones and tablets, and keeps working offline once loaded. Pro adds output styling, larger files and converting many files into one ZIP.

4.8out of 5

from 78 ratings

Rate this tool

Tap a star — it takes a second