> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/j/json-file.md).

# JSON File

The JSON File adapter imports devices from a JSON file that you copy to the connector. Use it for sources that have no adapter, one-off exports or test data.

## Use cases

* **Add devices from a system without an adapter.** Export the device list to JSON and bring it into the inventory.

```
Adapters = json-file
```

* **Find imported devices that no EDR sees.** Compare the imported devices with your EDR.

```
Adapters = json-file AND NOT Adapters = falcon-crowdstrike
```

* **List imported Windows devices.** Filter on the OS type key from the file.

```
Adapters = json-file AND OS.Type = Windows
```

## Before you begin

### Network

| Source              | Destination                      | Port           | Protocol       |
| ------------------- | -------------------------------- | -------------- | -------------- |
| OctoXLabs connector | Local file on the connector host | Not applicable | Not applicable |

The adapter reads a file from disk. It makes no network connection.

### Required permissions

The connector process must be able to read the file. The baseline asks you to check the file permissions after you copy the file.

## Create credentials in JSON file

This adapter needs no credentials. Prepare the file and copy it to the connector instead.

{% stepper %}
{% step %}

### Prepare the JSON file

Create a JSON file that contains either one object or a list of objects. Each object is one record. An empty file is rejected. Use the key names in the Fields fetched table.
{% endstep %}

{% step %}

### Copy the file to the connector

Copy the file to `/opt/octoxlabs/connector/media/json` on the connector host.
{% endstep %}

{% step %}

### Check the file permissions

Make sure the connector process can read the file, then run the connection test.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter      | Required | Type   | Default  | Description                                                                                                                                             |
| -------------- | -------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Filename       | Yes      | String | None     | File name or glob pattern inside the JSON folder. Absolute paths and `..` are not allowed. If a pattern matches several files, the newest file is used. |
| Hostname Field | No       | String | Hostname | JSON key that holds the hostname. A dotted path such as `info.hostname` reaches a nested key. Used only when a record has no `Hostname` key.            |

## Troubleshooting

| Error message                     | Cause                                                                                      | Fix                                                             |
| --------------------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------- |
| File not found with this pattern. | No file in the JSON folder matches **Filename**, or the match resolves outside the folder. | Copy the file to the JSON folder and check the name or pattern. |
| {filename} file is empty.         | The JSON file contains no data.                                                            | Add at least one record to the file.                            |

## Change history

{% hint style="info" %}
Available starting from version 3.1.0.
{% endhint %}
