100% local — your data never leaves your browser

YAML to JSON — Long IDs Kept Exact

Convert YAML to JSON. Large integers keep every digit and several documents become an array, ready to feed to an API or a script.

Instant Private Zero cookies
Indentation

YAML input

JSON output

What this tool does

YAML is a superset of JSON, so most of the conversion is uneventful: mappings become objects, sequences become arrays, scalars become strings, numbers, booleans or null.

What follows is where it stops being uneventful.

Long identifiers keep their digits

id: 12345678901234567890
{ "id": 12345678901234567890 }

That looks unremarkable, and it is the point. A JSON number is a double-precision float and holds about fifteen digits; a twenty-digit identifier — a Twitter snowflake, a PostgreSQL bigint — used to come back as a different number, silently. The digits are now read exactly and written out unchanged.

Anchors are expanded, because JSON cannot hold them

defaults: &d
  retries: 3
web:
  <<: *d

becomes two copies of retries: 3. JSON has no notion of a value appearing in two places, so the sharing cannot survive the crossing. The output is larger than the input, and nothing is lost — but the relationship is, and that is worth knowing before you convert a file built on anchors and convert it back.

Several documents become an array

--- separates documents. JSON has no separator, so a stream of three documents becomes an array of three values. A single document is not wrapped: you get the object.

Nulls, all three of them

~, null and an empty value all mean null in YAML, and all three become null. That is one place where JSON is simpler than YAML rather than the other way round.

What this conversion cannot decide for you

yes is read as the string "yes", because that is what YAML 1.2 says. A file written for PyYAML, which implements YAML 1.1, meant the boolean true.

Nothing in the file says which version its author had in mind. If your YAML comes from a Python tool and a bare yes, no or on matters, quote it at the source — and know that the ambiguity is in the file, not in the converter.

Private by design

Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.

Frequently asked questions

Why did my 20-digit ID use to come back wrong?
Because it went through a double-precision float, which holds about fifteen digits. `12345678901234567890` came out `12345678901234567000` — a different number, with nothing to warn you. The YAML reader can be told to keep large integers exact, and it now is, so the digits survive the conversion.
What happens to my anchors and aliases?
They are resolved: each `*alias` becomes a copy of what its `&anchor` held, and `<<:` merge keys are applied. JSON has no way to express sharing, so this is not a choice — it is the only faithful translation. The result is larger than the YAML, and that is the honest cost.
My file has several documents. What do I get?
A JSON array, one entry per document. `---` separates YAML documents and JSON has no equivalent; an array is the only form that keeps all of them. A file with a single document still gives you the object itself, not an array of one.

Related converters