JSON Flattener

Flatten nested JSON translation files to dot-notation keys or unflatten them back, with sorting and custom separators.

Keys
8
Depth
1
Size
0.3 kB

Runs in your browser. Files are not uploaded unless the tool says otherwise.

What does flattening a JSON translation file mean?

A nested JSON file groups translations in objects: { "checkout": { "title": "Checkout" } }. A flat file stores the same value under one dot-separated key: { "checkout.title": "Checkout" }. Both describe identical content, but many tools accept only one of the two shapes. Flattening converts nested objects into single-level keys, and unflattening rebuilds the object tree from the separator in the key names.

When do you need flat keys?

  • Spreadsheets, CSV exports and translation memories work with one row per key, so nesting has to go.
  • Some diff and review tools compare files line by line; flat files produce readable diffs when a single value changes.
  • Translation management systems store keys as strings. SimpleLocalize accepts both shapes on import and lets you pick nested or flat output when you export a single-language JSON file.
  • Scripts that count keys, search for placeholders or merge languages are simpler to write against a flat map.

Which i18n libraries expect which shape?

  • i18next reads nested objects by default and uses a dot as the key separator, so t("checkout.title") resolves either shape. Set keySeparator: false if your keys contain dots.
  • next-intl and vue-i18n read nested messages and address them with dot notation in components.
  • react-intl / FormatJS extraction produces flat files keyed by message id, and the compile step expects a flat map.
  • Angular and Transloco accept nested JSON; Transloco flattens it internally.

Arrays and edge cases

Arrays can be turned into indexed keys such as steps.0, steps.1, or kept as array values. Keys that already contain the separator are ambiguous after unflattening: a file with botha and a.b cannot be rebuilt, and the tool reports the conflict instead of silently dropping a value. Empty objects are removed unless you choose to keep them, because most libraries treat an empty group as no translations at all.

More translation tools

Manage translations with SimpleLocalize

  • Import the same file formats you just converted or checked
  • Auto-translate with DeepL, Google, OpenAI, Claude or Gemini using your own API keys
  • Free plan for small projects, no credit card required
Start for free
No credit card required5-minute setup