> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/api/guides/working-with-the-import-api-v2/importing-json-files.md).

# Importing JSON files

Whether it is the actual input file or the CSV or Excel template, the import API works with data formatted in JSON.

The import API accepts an array of objects where each object represents a command to be executed. The implicit operation for a command is `MERGE`. A merge creates or updates a resource in Collibra depending on the result of a query based on the parameters provided in the `[identifier](./import-commands.md#identifi)` field within the JSON object.

{% hint style="danger" %}
When importing assets from a CSV or Excel file, ensure that the input file is sorted by the asset identifier, such as the name or ID. If the file is not sorted, attributes, relations, or tags may be missing.
{% endhint %}

{% tabs %}
{% tab title="Example" icon="glasses-round" %}
General JSON file format

```json
[
  {command 1},
  {command 2},
  ...
]
```

{% endtab %}
{% endtabs %}

## Order of execution

By default, the importer splits commands into batches. Then, for each batch, the commands are sorted for optimal performance.

If a command depends on the result of a previous command, the previous command has to appear in the input data before the command that depends on it. Commands created from templates, such as DataWeave, should be sorted in the same way.

{% hint style="info" %}
Although not guaranteed, in some situations, the import may still work even if the order of the commands is not correct.
{% endhint %}

When you use a single file to import a community and a domain that belongs to it, the command to import the community should appear first. Additionally, if an asset, a domain or a community is created and mapping also needs to be created for a given resource, the mapping command should be second.

{% hint style="success" %}
To maximize performance, commands should be grouped by resource type within the input file:

```json
[
  {command for Community 1},
  {command for Community 2},
  ...
  {command for Community N},
  {command for Domain 1},
  ...
  {command for Domain M},
  {command for Asset 1},
  ...
  {command for Asset P},
]
```

{% endhint %}

## Command merging

During the import process, multiple subsequent commands with the same identifier are merged and executed as a single import command. This means that an imported asset has attributes and relations from all merged commands.

{% hint style="warning" %}
Only commands that immediately follow each other can be merged, otherwise the last command in the file can override the results of the previous commands with the same identifier.
{% endhint %}

{% hint style="info" %}
For consistent results, use one import command per unique identifier.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.collibra.com/api/guides/working-with-the-import-api-v2/importing-json-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
