DEV Community

Cover image for Why ChatGPT breaks your JSON i18n files (and what I built to fix it)
Ardam
Ardam

Posted on

Why ChatGPT breaks your JSON i18n files (and what I built to fix it)

https://localizejson.lovable.app
If you've ever tried to translate a JSON localization file using ChatGPT, you've probably run into this.You paste in something like this:
{
"welcome": "Welcome back, {name}!",
"messages": "You have {count} new messages",
"errors": {
"not_found": "Page not found",
"rate_limit": "Wait %d seconds"
}
}
And you get back something like this:
{
"welcome": "Bon retour, nom!",
"messages": "Vous avez nombre nouveaux messages",
"errors": {
"non_trouvé": "Page non trouvée",
"limite_taux": "Attendez secondes"
}
}
Three things just broke:

{name} got translated to nom — your app will now throw a runtime error
{count} disappeared entirely
%d vanished
The keys got translated too — your code references not_found but the file now says non_trouvé

Now you're spending 20 minutes manually fixing a file that should have taken 30 seconds.

Why this keeps happening
ChatGPT is a language model. Its job is to translate text. It doesn't understand that {name} is a code placeholder that must survive the translation unchanged, or that your keys are referenced directly in your codebase and cannot be modified.
You can prompt-engineer your way around it sometimes — adding instructions like "do not translate anything inside curly braces" — but it's unreliable. Complex nested files, arrays, and mixed placeholder formats like %d, {0}, or {{name}} trip it up constantly. And when it fails, it fails silently — you don't find out until something breaks in production.

What I built
I got frustrated enough to build a specific tool for this: Localizejson
It does one thing well — translates JSON i18n files while guaranteeing:

All keys are preserved exactly
All placeholders ({name}, %d, {count}, {{variable}}) survive unchanged
Nested objects and arrays are handled correctly
The output is valid JSON you can drop straight into your project

Upload your file, pick a language, get a clean translation back in seconds. No signup, completely free right now.

The before/after
Input:
json{
"welcome": "Welcome back, {name}!",
"messages": "You have {count} new messages",
"dashboard": {
"title": "Dashboard",
"stats": "{count} active users",
"growth": "{percentage}% growth"
},
"errors": {
"not_found": "Page not found",
"rate_limit": "Wait %d seconds"
}
}
Output (French):
json{
"welcome": "Bon retour, {name} !",
"messages": "Vous avez {count} nouveaux messages",
"dashboard": {
"title": "Tableau de bord",
"stats": "{count} utilisateurs actifs",
"growth": "{percentage}% de croissance"
},
"errors": {
"not_found": "Page introuvable",
"rate_limit": "Patientez %d secondes"
}
}
Every placeholder intact. Every key unchanged. Ready for production.

Try it
If you've hit this problem before, give it a try and let me know what's missing or broken — I'm actively improving it based on feedback.


https://localizejson.lovable.app

Top comments (0)