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

**`class JSONSaver(config)`**

Bases: [`Saver`](squirro.lib.nlp.steps.savers.Saver.md#squirro.lib.nlp.steps.savers.Saver)

Saves all [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) to a specified output_file in JSON format

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – json
- `output_file` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – path to output json file (relative to ml workflow path)
- `tracking_facet_name` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``'ml_workflow'`) – facet used to track whether an item has been processed
- `tracking_facet_value` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``None`) – Facet value to apply to tracking facet

**Example**

```json
{
    "step": "saver",
    "type": "json",
    "fields": [ "text", "prediction" ],
    "output_file": "data.json"
}
```

Methods SummaryMethods Documentation

**`process_batch(batch)`**

Process a batch of documents. If not defined will default to using
self.process_doc for each document in the batch.

Parameters

`batch` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`(`[`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)`)`) – List of documents

Returns

List of processed documents

Return type

[list](https://docs.python.org/3.11/library/stdtypes.html#list)([Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document))
