How to Translate JSON Files with AI in Seconds
Stop hand-translating i18n keys one by one. Here is how AI can batch-translate your entire locale file while preserving placeholders, context, and structure.
Let me paint a picture you have probably lived through. It is Wednesday afternoon. Your PM drops into Slack: "We need Japanese support by Friday." You open your en.json and see 200 keys staring back at you. Some are simple labels like "save": "Save". Others are paragraphs with embedded HTML and dynamic placeholders like "welcome": "Hello, {name}! You have <strong>{count}</strong> new messages."
You know the drill. You could copy-paste each value into Google Translate, pray it does not mangle your {curly_braces}, and spend the rest of the day reassembling the JSON structure by hand. Or you could pay a translation agency and wait three business days you do not have.
There is a better way. In this guide, I will walk you through how AI-powered JSON translation works, why it is fundamentally different from pasting strings into a generic translator, and how you can ship that Japanese locale file before your Friday deadline.
Why Manual JSON Translation is Painful
If you have worked with i18n in any modern framework like Vue, React, or Nuxt, you know that locale files are not just flat text. They are structured data with rules. Here is what makes translating them by hand so error-prone:
- Nested structures break easily. A single misplaced comma or bracket after pasting translations back into JSON will crash your build.
- Placeholders get destroyed. Generic translators love to "translate"
{userName}into something like{utilisateurNom}. Now your template bindings are broken and you are debugging why the page shows raw variable names. - Context is lost. The word "Save" means something different as a button label versus a noun. Without context, generic machine translation picks the wrong one half the time.
- HTML tags get mangled. Values containing
<strong>,<br>, or<a href="...">tags frequently come back with broken markup or translated attribute values. - Scale does not work. Translating 10 keys is fine. Translating 200+ keys across 5 languages is a full workday you should be spending on actual features.
Why AI Translation is Different (and Better)
AI translation for JSON is not just "Google Translate with extra steps." When done right, the AI model receives the full key-value pair, not just the value. That means it understands that nav.settings is a navigation label and error.file_too_large is an error message. This context changes everything.
A purpose-built AI JSON translation tool can also be instructed to follow strict rules:
- Preserve all placeholders. Variables like
{name},{count}, and%smust appear in the output exactly as they were in the source. The AI treats them as untouchable tokens. - Keep HTML structure intact. Tags like
<strong>and<br />pass through untouched. Only the human-readable text between tags gets translated. - Respect plural forms. Languages like Japanese, Arabic, and Polish have different pluralization rules. An AI that understands i18n conventions can adapt translations to match the target language's grammar.
- Maintain JSON structure. The output is valid JSON with the same nesting, same keys, and same ordering. No manual reassembly needed.
How It Works in Glot
In Glot, the workflow for translating a JSON file with AI takes about 30 seconds. Here is the actual process:
Step 1: Upload Your Source File
Open the Glot editor and drag your en.json (or whatever your source locale is) into the workspace. Glot parses the JSON instantly and displays it in a visual tree view. No upload to any server at this point. Everything is processed locally in your browser.
Step 2: Add a Target Language
Click "Add Language" and select your target, say Japanese (ja). Glot creates a new locale file with all the same keys, ready to be filled in.
Step 3: AI Translates All Keys
Hit the translate button. Glot sends your key-value pairs to an AI model (GPT-4o-mini) in batches of 50 items, with full context about the source and target languages. Within seconds, every key has a translation. Your {name} placeholders are untouched. Your HTML tags are intact. The JSON structure is preserved.
Step 4: Review and Export
Use the visual tree view or flat table view to scan translations side-by-side. Glot also has a built-in quality check that flags empty values, placeholder mismatches, and other common issues. When you are satisfied, export as JSON and commit it to your repo.
That is it. Your 200-key ja.json file is done, and it is still Wednesday.
AI Translation vs. Google Translate vs. DeepL for JSON
You might be wondering: why not just use Google Translate or DeepL directly? Both are excellent general-purpose translation engines. But they were not designed for structured data like i18n JSON files.
Google Translate
Great for translating a sentence. Terrible for translating a JSON file. You have to extract each value manually, translate it, and paste it back. It does not understand that {count} is a variable. It will frequently break HTML tags. There is no batch mode for key-value pairs.
DeepL
Higher translation quality for European languages, but the same structural problems apply. DeepL's API can be scripted, but you still need to write a wrapper that handles placeholder preservation, JSON parsing, batching, and error handling. That is a side project in itself.
Purpose-Built AI Translation (Glot)
The AI model receives the key name alongside the value, giving it semantic context. It is explicitly instructed to preserve placeholders and HTML. The output is valid JSON with the same structure. And you get a visual diff to review everything before exporting. No scripting, no API wrappers, no broken brackets.
Real Limitations (and How to Handle Them)
AI translation is not perfect, and pretending otherwise would be dishonest. Here are the real limitations and how to work with them:
- Nuanced brand voice. AI translations are accurate but generic. If your app has a very specific tone (playful, ultra-formal, slang-heavy), you will want a native speaker to do a review pass. Use AI to get the first draft done in seconds, then refine the 5-10% that needs a human touch.
- Context-dependent terms. Short strings like
"draft"could mean a document draft or a sports draft. The key name usually provides enough context (document.status.draft), but occasionally you will need to correct an ambiguous translation. - Complex pluralization. Some languages have 6+ plural forms (looking at you, Arabic). If your i18n library uses ICU MessageFormat, the AI handles it reasonably well. For simpler key-based plurals (
item_one,item_other), it works great out of the box. - Legal or medical content. If your app deals with regulated content, always have translations reviewed by a professional. AI is your first draft, not your final sign-off.
The practical approach: use AI for 90% of the heavy lifting, then invest your human review time where it actually matters.
The Developer Workflow That Actually Works
After using this workflow across multiple projects, here is what I have settled on:
- Develop in your source language. Write all your i18n keys in English (or whatever your primary locale is). Do not think about translations until the feature is stable. If you are new to structuring i18n files, check out our complete i18n JSON translation guide for Vue, React, and Nuxt.
- Batch-translate when ready. Once a feature ships to staging, drop your updated
en.jsoninto Glot and translate all new keys at once. - Run the quality check. Glot flags missing placeholders, empty values, and inconsistencies. Fix those before exporting.
- Commit and move on. Export the translated JSON files, commit them to your repo, and get back to building features instead of copying strings between browser tabs.
This workflow has cut our localization time from days to minutes. The AI handles the grunt work. We handle the edge cases.
Getting Started
If you have a JSON locale file and a deadline, you can start translating right now. No account required for basic editing. Just open the Glot editor, drag in your file, and see how fast AI can knock out your translation backlog.
For teams shipping products in multiple languages, this is not a nice to have anymore. It is how modern i18n gets done.
Ready to Translate Your JSON Files?
Upload your locale file and let AI handle the translations. Works with Vue, React, Nuxt, and any framework that uses JSON for i18n.
Translate JSON with Glot