# 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


---

# Agent Instructions: 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:

```
GET https://cgps.gitbook.io/data-flo/reference-guide/import-from-json-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
