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 new key via web interface, use :: to refer JSON levels, for example main::username.

Triple colon (:::) is used force object type for 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 would get exported back as an array in case all sequental elements are present. If any of elements is missing, the keys will be exported as an object.

Export example with one key missing (main::1 was deleted in this case):

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

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

Three colon (:::) example. 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?