# import-from-json-file

## Description

<mark style="color:purple;">`import-from-json-file`</mark> *adaptor imports data from a file in JSON format*.

You can use the `filter` parameter to slice, filter, map and transform structured data. This adaptor imports the JSON file into Data-flo to make it available to other adaptors for processing.

## Inputs

**`json`**\
Type: `file`\
Required: Yes\
A file in JSON format.

**`filter`**\
Type: `text`\
Required: No\
An optional [JQ filter](https://jqlang.github.io/jq/).

## Outputs

**`data`**\
Type: `datatable`\
Data read from the file.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`json:` person.json

`filter:` *null (empty)*

#### Outputs:

`data`:

```
{
  "user": "Alice",
  "age": 30,
  "email": "alice@example.com",
  "city": "New York"
}
```

-> Imported the json file `person.json` into Data-flo.

### Example 2: Import json file and apply a filter on it.

#### Inputs:

`json:` person.json

`filter:` {name, email}

#### Outputs:

`data`:

```
{
  "user": "Alice",
  "email": "alice@example.com"
}
```

-> Filtered the json data to only get the name and email from the json file.

## Use Cases

Enables users to import files in JSON format for further processing and transformation in Data-flo
