Search result not found.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

On this page

Locize Docs

Introduction

Using locize

Integration

Guides / Tips & Tricks

More

Which integration option should I use?Do I have to use the locize CDN or can I host / bundle the translations directly?How is locize different from the alternatives?Why do I get “The passed json is nested too deeply.” when consuming the API?Is locize only for developers and translators or is project management within the process too?What is the regular way to update the translation memory?Is there any visibility on project’s level of completion that shows how translators are progressing?Why is my namespace suddenly a flat json?How to change the publish format?Why does my namespace contain an array with a lot of null items?Why is the pricing so complicated?How to change credit card or billing information or download the invoices?How to import translations from a file?How to manually publish a specific version?How to delete or rename a namespace?Why is there such a high download amount?Where do I find the namespace backups?How can a segment/key be copied/moved or renamed?Why a new namespace is created, when I upload a translation file?I want to use the locize CDN, but would like to have a fallback that uses local/bundled translationsIs it possible to integrate multiple projects in the same app/website?Why do I see strange new keys marked as ONE, FEW, MANY, OTHERS?How do I open and edit JSON files?i18n vs. i18nexti18next vs. locizeWord CounterHow to style text within locize?What do I have to consider if my translation texts may contain confidential information?How to translate a file and download the results?

Why does my namespace contain an array with a lot of null items?

When locize serves nested json, it tries to unflatten the keys which by default thinks that key parts being numbers, should be items of an array.

Suppose, you have the following keys:

{
    "colors.title": "Colors",
    "colors.enum.0": "red",
    "colors.enum.1": "green",
    "colors.enum.2": "blue"
}

This would be published as a nested json like this:

{
    "colors": {
        "title": "Colors",
        "message": [
            "red",
            "green"
            "blue"
        ]
    }
}

But sometimes you do no like to have an array.

For example, having these keys:

{
    "error.title": "Errors",
    "error.message.400": "Bad request",
    "error.message.401": "Not authorized",
    "error.message.404": "Not found"
}

Would be published as a nested json like this:

{
    "error": {
        "title": "Errors",
        "message": [
            null,
            null,
            null,
            // up to the array index 400...
            "Bad request",
            "Not authorized"
            "Not found"
        ]
    }
}

To prevent this add a non-numeric key, like this:

{
    "error.title": "Errors",
    "error.message.unknown": "Unknown error",
    "error.message.400": "Bad request",
    "error.message.401": "Not authorized",
    "error.message.404": "Not found"
}

This would be published as a nested json like this:

{
    "error": {
        "title": "Errors",
        "message": {
            "unknown": "Unknown error",
            "400": "Bad request",
            "401": "Not authorized",
            "404": "Not found"
        }
    }
}

We do recommend to not mix nested and flat keys format.

i.e. keys like that:

{
  "my.3.paragraph": {
    "someNested": "key"
  }
}

will be represented like this in flat format:

{
  "my.3.paragraph.someNested": "key"
}

and like this in nested format:

{
  "my": [
         null,
         null,
         null,
        {
          "paragraph": {
            "someNested": "key"
         }
       }
    ]
}
How to change the publish format?

On this page