---
title: Upload JSON files to MindsDB
sidebarTitle: JSON
---

You can upload JSON files of any size to MindsDB that runs locally via [Docker](/setup/self-hosted/docker) or [pip](/contribute/install).

JSON files are converted into a table, if the JSON file structure allows for it. Otherwise, JSON files are stored similarly to text files.

<Accordion title="Sample format of a JSON file">
Here is the sample format of a JSON file that can be uploaded to MindsDB:

```
[
    {
        "id": 1,
        "name": "Alice",
        "contact": {
            "email": "alice@example.com",
            "phone": "123-456-7890"
        },
        "address": {
            "street": "123 Maple Street",
            "city": "Wonderland",
            "zip": "12345"
        }
    },
    {
        "id": 2,
        "name": "Bob",
        "contact": {
            "email": "bob@example.com",
            "phone": "987-654-3210"
        },
        "address": {
            "street": "456 Oak Avenue",
            "city": "Builderland",
            "zip": "67890"
        }
    }
]
```

MindsDB converts it into a table where each row stores the high-level object.

```sql
| id  | name  | contact                                              | address                                                         |
| --- | ----- | ---------------------------------------------------- | --------------------------------------------------------------- |
| 1   | Alice | {"email":"alice@example.com","phone":"123-456-7890"} | {"city":"Wonderland","street":"123 Maple Street","zip":"12345"} |
| 2   | Bob   | {"email":"bob@example.com","phone":"987-654-3210"}   | {"city":"Builderland","street":"456 Oak Avenue","zip":"67890"}  |
```

You can extract the JSON fields from `contact` and `address` columns with the `json_extract` function.

```sql
SELECT id, 
       name, 
       json_extract(contact, '$.email') AS email, 
       json_extract(address, '$.city') AS city
FROM files.json_file_name;
```
</Accordion>

## Upload files

Follow the steps below to upload a file:

1. Click on the `Add` dropdown and choose `Upload file`.

<p align="center">
  <img src="/assets/files/upload_file.png"/>
</p>

2. Upload a file and provide a name used to access it within MindsDB.

<p align="center">
  <img src="/assets/files/upload_file_from_computer.png"/>
</p>

3. Alternatively, upload a file as a link and provide a name used to access it within MindsDB.

<p align="center">
  <img src="/assets/files/upload_file_from_url.png"/>
</p>

## Query files

Here is how to query data within MindsDB.

Query for the content of the file uploaded under the name `my_file`.

```sql
SELECT *
FROM files.my_file;
```
