> For the complete documentation index, see [llms.txt](https://learn.coremodels.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.coremodels.io/user-guides/json-schema/import-json-schema.md).

# Import (JSON Schema)

### Step By Step Guide <a href="#step-by-step-guide" id="step-by-step-guide"></a>

Expand the features tray, then from channels, click on 'Import JSON-Schema' to open the Import UI.

<figure><img src="/files/4zO4HFdvycegDSdCencQ" alt=""><figcaption><p>Navigation to Import JSON-Schema</p></figcaption></figure>

From the Import UI, you can create a new space (see [Core Concepts](/core-concepts.md#spaces)) or choose an existing space to import to, In this tutorial we will create a new space 'Sample Space'.

<figure><img src="/files/qkwVD3doKVTxhWGTuYEK" alt=""><figcaption><p>Import JSON-Schema UI</p></figcaption></figure>

Select the newly created space to show the 'Data Sources' UI.

<figure><img src="/files/1cDFzg35H6oIh6mXLKVH" alt=""><figcaption><p>Data Sources UI</p></figcaption></figure>

From this UI you can add and control the data sources that will be connected to the selected space.

You can click on "Add Data source" (1) to add a source by URL, upload a file (.json), or even connect your account to github and fetch the file from there. We will use a simple example, you can use [this url](https://raw.githubusercontent.com/ModarAlNacharA/my-sample-repository/refs/heads/main/ArticleSample.json).

{% hint style="info" %}
Alternatively you can use the Crawl URL feature (2) where you can provide a url.&#x20;

CoreModels will scan for all JSON links and automatically add it to the list.

You can also provide a github folder url in the Crawl URL feature (2) and it will automatically add the files in that directory
{% endhint %}

(Optional) You can click on 'Advanced Settings' to view the import profile settings (more information at [#json-schema-profile](#json-schema-profile "mention")).

Once the schema files are added click on 'Scan Files' (4), this will start a two phases scans

1. First, it will scan for used references that are included in `$ref` and automatically add them in the list.\
   If any new reference is added you will get a prompt in order to continue or review the list.
2. Second, CoreModels will scan the files and detect all the JSON Schema (and non-JSON Schema) keywords that have been used in your schema.

CoreModels will then show a preview of all the import that will happen to the space.

In our tutorial we are starting from a freshly created space, therefor all the schema nodes are new to the space.

<figure><img src="/files/A4OoYX5gqnRzBakEPdC2" alt=""><figcaption><p>Import preview</p></figcaption></figure>

By clicking the Import button, CoreModels will validate and show any necessary notification, then prompt the user in order to continue, and show the tasks UI where it will start the import process.&#x20;

Once it's done, CoreModels will automatically refresh the page.

***

We can now navigate to the Types Grid tab and see the schema. The sample we used should show the following.

<figure><img src="/files/ivycuMDHYpJzqjixmF3G" alt=""><figcaption><p>JSON Schema Sample file import result - Types Grid</p></figcaption></figure>

<figure><img src="/files/6UHAQM4YuPROqZxqm7NE" alt=""><figcaption><p>JSON Schema Sample file import result - card preview</p></figcaption></figure>

Next, let's configure the grid to show the mixins and the rules that were added along with the schema.

<figure><img src="/files/SO7dwWaEEnv9ZlhHwV7V" alt=""><figcaption><p>JSON Schema Sample file import result - grid configuration</p></figcaption></figure>

Open the 'configuration' side panel (1), and configure the grid to show 'JSON Schema Rules' and the 'JSON Schema Mixin', add this to both 'Type Columns' (2) and 'Element Columns' (3), you can then explore the added elements by expanding 'Elements' (4), and find the metadata or the validation rules for your schema at the 'JSON Schema Rules' mixin (5).

***

CoreModels has a special UI for 'Combination' and 'Conditional' keywords, such as `anyOf`, `allOf`, `oneOf`, `not`, `if`, `else`, `then`. All of them can be managed using the 'JSON Schema Rules' mixin, it provides a powerful UI - the 'Rule Builder' - where you can view and edit the rules.

<figure><img src="/files/A3pIH9mOxPUiCLRfwmSt" alt=""><figcaption><p>JSON Schema Sample file import result - rules viewer</p></figcaption></figure>

Now that you have imported your schema, let's see how to [export](/user-guides/json-schema/export-json-schema.md) it or synchronize it from github using the [merge feature](/user-guides/json-schema/synchronize-json-schema.md), or push the changes from CoreModels to the github repository [Push To Github (JSON Schema)](/user-guides/json-schema/push-to-github-json-schema.md).

***

Note: If you have created the project using the 'JSON Schema Template', some terminology items from this tutorial will be slightly different to better align with the JSON Schema community:

* 'Types Grid' would be named 'Objects Grid'
* 'Elements' would be named 'Properties'

You can always switch the template from the 'Project Admin' -> 'Settings' at the 'Maintenance' tab

***

#### JSON-Schema profile

The profile shows some commonly used JSON Schema keywords, and also the keywords that are used in your schema, `$id`, `$anchor`, `$ref` etc..

Some keys will have some disabled fields because they have some special handling in CoreModels to align with how they are used. You will find below a table for each option:

<table><thead><tr><th width="137.7999267578125">Input</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>Key</td><td>The name of each JSON key that was found in the JSON Schema sources.</td><td>it may be followed by a hint, if the key was a special JSON Schema key.</td></tr><tr><td>Transformed to</td><td><p>This field controls the options found in 'transformation value'.<br>In simple terms, when a field is storing regular text values, we choose 'mixin' or 'new mixin'.<br>an example from the sample file would be the '$id' property.</p><p></p><p>But if the value is actually referring to another node in the graph, then we should set it as 'Relation' (ex: 'properties' key).</p></td><td><p>None -> do not import.</p><p>Mixin -> the values will be stored as text, allows choosing mixins under 'transformation value' column.</p><p>New Mixin -> the values will be stored as text, allows entering the new mixin name.</p><p>Relation -> the values will point to other nodes, allows choosing relations under 'transformation value' column (if the importer finds a relation to a non-existing node, it will automatically create it).</p><p>Relation -> the values will point to other nodes, allows entering the new relation name</p></td></tr><tr><td>Export Format</td><td>CoreModels will identify each property's type according to the JSON Schema values that were found for this property.<br>changing this has no impact during the import but it's stored to preserve how each property should look like in the export.</td><td><p>"key": null -> Null</p><p>"key": true -> Boolean</p><p>"key": 12 -> number</p><p>"key": "myValue" -> String</p><p>"key" : {"innerKey":"innerValue"} -> Object</p><p>"key": ['val1', 'val2'] -> Array</p></td></tr></tbody></table>

{% hint style="info" %}
CoreModels treats object schemas as **types**, while all other schemas are considered **elements**.\
A schema is identified as a **type** if either:

* The value of the **`type`** keyword is set to `"object"`, or
* The schema defines a **`properties`** keyword.
  {% 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, and the optional `goal` query parameter:

```
GET https://learn.coremodels.io/user-guides/json-schema/import-json-schema.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
