JSON (JavaScript Object Notation) flat files are commonly used for managing localization strings in various applications due to their simplicity and readability. Flat JSON files store data as key-value pairs without nested structures, making them easy to work with. Lokalise supports flat JSON files, allowing efficient translation management within your projects.
Technical information
Overview
Format name:
JSON Flat
File extensions:
.json
Common use cases:
Managing and organizing localization strings in web and mobile applications.
Technical details:
Structure: Flat JSON files consist of key-value pairs where each key represents a specific translation string. The keys are not nested, maintaining a flat structure.
Encoding: UTF-8
Example:
Here's an example of a typical flat JSON file used for localization:
{
"app.name": "Lokalise",
"app.description": "Nice service"
}
In this example, the JSON file includes two keys: app.name
and app.description
, each mapped to their corresponding translations.
TypeScript Integration
If you are using TypeScript and want to add an autocompletion feature for your key names, you can add the following line of code to your app:
keyof typeof import ('./path/to/some/json/file.json')
Using with Lokalise
Lokalise supports flat JSON files, making it easy to manage and translate your localization strings within the platform.
Supported project types
Please note that JSON files can be uploaded only to Web and mobile projects.