Free tool

Convert i18n YAML to JSON

Rails, Symfony and Hugo keep translations in YAML. Most JavaScript i18n libraries want JSON. Both directions, in the browser.

Runs in your browser. No account, no upload, nothing leaves your machine.

YAMLJSON

Runs in your browser. The file is never uploaded.

A reader for the subset i18n files actually use

This is deliberately not a general YAML parser. A complete one is around 100 KB of JavaScript for a format that in locale files never does more than key, colon, text. What it does read is nested mappings with string leaves, both quoting styles, and block scalars with | and >. What it does not read (lists, anchors, aliases, flow style) stops the conversion with the offending line number rather than being silently misread, which is the failure mode that matters: a dropped list is a missing string nobody notices until it is on screen.

What survives

Converting is easy. Not breaking the file is the hard part.

Every converter that treats a language file as plain text will eventually ship you a crash. These are the three places it happens.

Placeholders stay placeholders
%@, %lld, %1$s, {name} and {{count}} come out exactly as they went in. A placeholder that got escaped, renumbered or translated is a crash on the device, not a typo.
Plural forms stay separate
Xcode variations, the Android plurals element and gettext msgstr[n] all mean the same thing and all spell it differently. They map onto each other here instead of collapsing into one string. Polish has four forms; all four survive.
Keys keep their shape
Nesting, dotted paths, arrays and translator comments carry across wherever the target format has somewhere to put them. Where it does not, the section below says so.

What does not come across

Written down here, because the alternative is finding out in a broken build.

The top-level locale key stays where it is. A Rails file starting with de: produces keys like de.hello rather than hello, because stripping it would be convenient right up until someone converts a file that does not have one, at which point the first real level disappears. Comments are not carried across. Writing YAML, values that would otherwise be read back as booleans or numbers (yes, no, on, off, 3.14) are quoted.

How it works

  1. Step 1

    Drop the file in

    Drag your YAML onto the left box, pick it with the file button, or paste the text. Nothing is uploaded. The conversion runs in this tab.

  2. Step 2

    Read the result

    The JSON appears as you type. The counter under the box says how many keys came through, so a file that lost half its content is visible immediately.

  3. Step 3

    Copy or download

    Take the text to the clipboard, or download it with the right extension. Swap the arrow to go the other way.

One language file in. 64 languages out.

Converting a format is the part you can do by hand. Translating 3,627 keys into 64 languages without breaking a single placeholder is the part you cannot. On the next release you only pay for the strings that changed.

€19 per month incl. VAT, cancellable monthly.

Questions

Why does my output start with de. on every key?
Because your YAML has the locale as its top-level key, as Rails files do. It is kept on purpose: guessing which top-level keys are locale codes would eventually delete a real level of nesting. Delete the prefix in the JSON if you do not want it.
It refused my file with yamlUnsupported.
The detail next to the message names the line. That happens on list items, anchors and aliases, or flow style such as a mapping written inline in braces. Stopping is deliberate: the alternative is dropping strings quietly.
Are multi-line block scalars supported?
Yes, both | and >. Literal blocks keep their line breaks; folded blocks are joined into one line with single spaces, which is what > means.
Which YAML does it write?
Two-space indentation, nested mappings, and quotes on anything that would otherwise change meaning on the way back in. The result parses with any standard YAML loader.