Skip to content

JSON Structure-Preserving Translator | Free Tool

A free browser tool that tags each string in a JSON file with a target language code while leaving keys, numbers, booleans, and structure completely unchanged.

JSON Structure-Preserving Translator

This tool translates the content of JSON objects while preserving their structure. Paste your JSON in the left panel, select a target language, and see the translated output on the right.

Translated output will appear here...

How to Use

  1. Paste your JSON object in the Source JSON field.
  2. Select your target language from the dropdown menu.
  3. The translated JSON will automatically appear in the right panel.
  4. Click the Copy button to copy the translated JSON to your clipboard.
Loading calculator...
📚

Documentation

What Is a JSON Structure-Preserving Translator?

A JSON structure-preserving translator is a tool that walks through a JSON document and changes only the text values inside it. Object keys, numbers, true/false values, and null all stay exactly as they were. Only the strings are touched.

This version of the tool does not send any text to a translation service. It runs entirely in the browser. For each string it finds, it adds the target language code in brackets in front of the original text, for example [es] Hello. This lets a developer preview exactly which parts of a JSON file would be translated, and confirm that the structure survives the process, before connecting a real translation service.

How It Works

The tool applies one rule, repeated at every level of the JSON tree:

  • If a value is a string, add the target language code in brackets before it: text becomes [code] text. An empty string is left as "".
  • If a value is a number, true, false, or null, leave it unchanged.
  • If a value is an array, apply this rule to every item, in the same order.
  • If a value is an object, apply this rule to every value, and keep every key unchanged.

The tool checks the input JSON for valid syntax first. If the JSON cannot be parsed, it stops and shows an error instead of guessing.

How to Use the Tool

  1. Paste a JSON object into the "Source JSON" field on the left.
  2. Choose a target language from the dropdown. Nine languages are available: Spanish, French, German, Italian, Portuguese, Chinese, Japanese, Korean, and Russian.
  3. The right panel updates automatically. No button needs to be clicked.
  4. Click "Copy" to copy the result to the clipboard.
  5. Click "Clear All" to reset both panels and start over.

Example

Input JSON:

1{
2  "app": {
3    "title": "My Store",
4    "version": 2,
5    "isBeta": false,
6    "tags": ["sale", "new"]
7  }
8}
9

With Spanish (es) selected as the target language, the tool produces:

1{
2  "app": {
3    "title": "[es] My Store",
4    "version": 2,
5    "isBeta": false,
6    "tags": [
7      "[es] sale",
8      "[es] new"
9    ]
10  }
11}
12

Notice that "title" and "tags" stay as keys, 2 and false stay unchanged, and only the string values gain the [es] tag. The nesting and array order are identical to the input.

What Changes and What Stays the Same

JSON elementResult
String valueGets a [language code] prefix
NumberUnchanged
true / falseUnchanged
nullUnchanged
Object keyAlways unchanged
Array orderAlways unchanged
Empty string ""Unchanged

This matters most for files where the structure carries meaning, such as an i18n (internationalization) file used by a web app, or an API response that client code reads by key name. If a key like "welcomeMessage" changed during translation, code that looks up welcomeMessage would break. This tool never touches keys, so that risk does not apply here.

Common Errors

"Invalid JSON format. Please check your input." This appears when the pasted text is not valid JSON. Typical causes are a missing comma between entries, a trailing comma after the last item, single quotes instead of double quotes, or an unescaped special character inside a string. Running the input through a JSON validator first can help find the exact spot.

"Translation failed. Please try again." This appears in one specific case: when the pasted input is the single word null with nothing else. Since there is no structure to walk through, the tool has nothing to process. Wrapping the value in an object, such as {"value": null}, avoids this.

Leaving the input field empty shows a placeholder message and is not treated as an error.

Why Structure Preservation Matters

JSON files that store app translations, such as en.json and fr.json, usually need identical keys so the surrounding code can look up the same path in any language, for example user.profile.displayName. The same is true for API responses read by field name, and for configuration files where a key name change can break a deployment. Preserving structure while marking translatable strings is a useful first step before those strings are sent to an actual translation service or reviewed by a translator.

Frequently Asked Questions

Does this tool call a real translation service? No. It runs only in the browser and does not send data anywhere. It marks each string with the target language code instead of producing translated words.

Why does my output show [es] Hello instead of Hola? That bracketed tag is the placeholder behavior of the current version. It shows which strings would be translated and to which language, without performing real translation.

Will it change my object keys or numbers? No. Keys, numbers, true/false, and null pass through unchanged at every level of nesting, including inside arrays.

Does it need an internet connection? No. Parsing and tagging happen locally in the browser tab.

Can I use this for i18next or similar translation files? The output keeps the same key structure as the input, so it fits any framework that expects matching keys across language files. The string values themselves still need to be replaced with real translations before use.

What happens with deeply nested JSON or arrays inside arrays? The tool processes every level, however deep, and every array item, applying the same rule each time.

References