In addition to flat JSON files, Lokalise supports nested JSONs with unlimited depth:

{
  "main": {
    "username": "User name",
    "password": "Enter password",
    "app": "Lokalise"
  }
}


Separator

Double colon (::) is used as a seperator for nested JSON arrays.

When adding a new key via the web interface, use :: to refer JSON levels, for example main::username.

The triple colon (:::) is used force object type for the resulting JSON. See examples below.

Examples

Let's import an example JSON:

{
  "main": [
    "Item 1",
    "item 2",
    "Item 3"
  ]
}

Here are the keys created:

main::0
main::1
main::2


These keys will exported back as an array if all sequential elements are present. If any of the elements is missing, the keys will be exported as an object.

Here is an export example with one key missing (main::1 was deleted in this case):

{
    "main": {
        "0": "Item 1",
        "2": "Item 2"
    }
}

As you can see, it's no longer an array. Now it's being exported as an object as the keys are not numbered in the correct order.

Here is a three colon (:::) example. The resulting JSON is always exported as an object.

main:::0
main:::1
main:::2

The export example using three colons (:::) in key names:

{
    "main": {
        "0": "Item 1",
        "1": "Item 2",
        "2": "Item 3"
    }
}
Did this answer your question?