Skip to content

invalid-json ​

Error · The file is not a JSON object.

git8n check fails on this rule.

Why it matters ​

The application cannot load a file that does not parse, and the editor cannot read it or write it. Every key of the file is then missing in this language.

Invalid ​

locales/en/common.json

json
{
  "title": "Hello"
}

locales/fr/common.json

json
{
  "title": "Bonjour",
}
text
$ git8n check --source en
locales/fr/common.json
  error    Expected double-quoted property name in JSON at position 24 (line 3 column 1)  invalid-json

Read more:
  invalid-json  https://git8n.sakuga.dev/docs/reference/rules/invalid-json.html

1 error, 0 warnings in 2 files (en → fr, 1 key).

Valid ​

locales/en/common.json

json
{
  "title": "Hello"
}

locales/fr/common.json

json
{
  "title": "Bonjour"
}
text
$ git8n check --source en
0 errors, 0 warnings in 2 files (en → fr, 1 key).

What to do ​

Correct the JSON: a trailing comma, a missing quote and a comment are the usual causes. The top of the file must be an object.

All the rules · The command check