Broadly there are two scenarios where key collisions can occur in exported files:
1. Duplicate keys
When translations are indexed by non-unique keys (most commonly source text) duplicate keys can collide.
See Duplicate key collisions and how to use context.
2. Nesting collisions
Translations may be indexed by unique IDs, but key expansion can create overlapping properties inside nested structures.
See Nested object collisions and how to avoid them.
Loco also supports custom aliases which can suffer both of these problems, but most commonly you'll be affected by one or the other.
Legacy export behaviour
In October 2024 we identified some bugs in the resolution of key collisions as they occur in nested objects like JSON, YAML and PHP.
In short, the Export API attempts to merge conflicts by default. In some cases this produced unexpected output, and could cause further side effects if imported back into the project.
These bugs are fixed, but your project may still be affected. See the product notice for details on how the incorrect behaviour has been migrated without disrupting any existing file exports.