<!-- Source: https://docs.squirro.com/en/latest/api/squirro.lib.nlp.steps.loaders.JSONLoader.html -->
# JSONLoader

**`class JSONLoader(config)`**

Bases: [`Loader`](squirro.lib.nlp.steps.loaders.Loader.md#squirro.lib.nlp.steps.loaders.Loader)

The JSON [`Loader`](squirro.lib.nlp.steps.loaders.Loader.md#squirro.lib.nlp.steps.loaders.Loader) loads JSON files and transforms the data into [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) items.

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – json
- `per_line` ([`bool`](https://docs.python.org/3.11/library/functions.html#bool)`, ``False`) – indicates if each line represents a different item document

**Example**

```json
{
    "step": "loader",
    "type": "json",
    "fields": [ "text", "label" ]
}
```

Methods SummaryMethods Documentation

**`process(directory)`**

Process a directory of json files and yield documents.

Parameters

`directory` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – path to directory with *.json files

Returns

Generator of Documents read from JSON files

Return type

generator([Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document))
