Skip to main content
shipi18n logo|Documentation

invalid-json: broken JSON in a translation file

error — fails the build

A locale file could not be parsed as JSON — a trailing comma, an unescaped quote, a merge-conflict marker. Every key in the file is effectively gone at once: depending on your setup the build fails, or the whole language silently falls back to English.

What triggers it

// es.json — trailing comma after the last entry
{
  "title": "Inicio",
  "cta": "Empezar",
}

Fixed

{
  "title": "Inicio",
  "cta": "Empezar"
}

Why it matters

Broken translation JSON is the highest-blast-radius i18n defect there is — one character takes out an entire language — and it routinely gets past review because nobody opens every locale file in a PR.

How to fix it

Open the file at the position in the parser error and fix the syntax. Most cases are a trailing comma, an unescaped quote inside a string, or leftover merge-conflict markers (<<<<<<<).

How to silence it

This one cannot be silenced per-key — an unparseable file has no keys to ignore. Fix the syntax.

Check for this in CI

npx @shipi18n/cli check ./locales -s en
# SARIF for inline PR annotations:
npx @shipi18n/cli check ./locales -s en -r sarif -o shipi18n.sarif

The structural checks need no API key. Findings of this rule link back to this page from the SARIF helpUri.

Related rules