> ## Documentation Index
> Fetch the complete documentation index at: https://hyperlocalise.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Translate JSON localization files with Hyperlocalise

> Translate nested JSON messages while preserving keys and placeholders.

JSON stores messages as key-value data and is commonly used by web application localization libraries. Hyperlocalise translates string values in supported JSON catalogs; keep application settings separate from translation files.

Supported extensions: `.json`.

## Source file

Save this example as `locales/en-US/messages.json`.

```json theme={null}
{
    "home": {
        "title": "Welcome",
        "greeting": "Hello, {name}!"
    }
}
```

## Configure your files

Use this `i18n.yml` for the example, or add its file mapping to your existing bucket.
See [path templates](/cli/configuration/path-templates) for other layouts.

```yaml theme={null}
locales:
    source: en-US
    targets:
        - es-ES

buckets:
    messages:
        files:
            - from: locales/en-US/messages.json
              to: locales/{{target}}/messages.json

llm:
    profiles:
        default:
            provider: openai
            model: gpt-5.2
```

## Translate

[Install the CLI](/cli/getting-started/install) and set `OPENAI_API_KEY` in your
project's `.env.local` or shell. You can also configure another
[AI provider](/cli/providers/overview).

```bash theme={null}
hyperlocalise run --dry-run
hyperlocalise run
```

The dry run previews the work. The second command writes translations to the
configured target path and updates the lockfile.

## Behavior and limitations

* Nested objects use dotted keys such as `home.title`; arrays use indexed paths. Translation leaves must be strings.

* Numbers, booleans, and other non-string leaves are rejected. Keep application settings separate from locale messages.

* Output preserves the JSON data structure, but indentation and object ordering may change.

* Strict FormatJS catalogs are detected automatically: `defaultMessage` is translated and `description` supplies context. See [FormatJS](/cli/reference/formats/formatjs).

## Next steps

* [Check translations](/cli/commands/check) before committing generated files.
* [Local translation workflow](/cli/workflows/local-generation) explains repeat runs.
* [Browse all file formats](/cli/reference/formats/overview).

## Related formats

* [JSONC localization](/cli/reference/formats/jsonc)
* [FormatJS and React Intl catalogs](/cli/reference/formats/formatjs)
* [YAML localization](/cli/reference/formats/yaml)
