> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindsdb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload JSON files to MindsDB

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 theme={null}
  | 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 theme={null}
  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="https://mintcdn.com/mindsdb/U8_C23ppbMIBDBSs/assets/files/upload_file.png?fit=max&auto=format&n=U8_C23ppbMIBDBSs&q=85&s=0a25773f735c4f147425651de94caca4" width="1042" height="666" data-path="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="https://mintcdn.com/mindsdb/U8_C23ppbMIBDBSs/assets/files/upload_file_from_computer.png?fit=max&auto=format&n=U8_C23ppbMIBDBSs&q=85&s=bd588de4dd6fa52b36eec2761e3242b3" width="868" height="834" data-path="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="https://mintcdn.com/mindsdb/U8_C23ppbMIBDBSs/assets/files/upload_file_from_url.png?fit=max&auto=format&n=U8_C23ppbMIBDBSs&q=85&s=3d2919867ba34c821c8a153a9ece4efe" width="886" height="804" data-path="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 theme={null}
SELECT *
FROM files.my_file;
```
