# integreat-adapter-json

> JSON adapter for Integreat

Latest version **1.0.4** (published 2026-04-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install integreat-adapter-json
pnpm add integreat-adapter-json
yarn add integreat-adapter-json
bun add integreat-adapter-json
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2026-04-14 |
| First published | 2019-01-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM |
| Node | >= 18 |
| Dependencies | 0 |
| Unpacked size | 22.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Author | Kjell-Morten Bratsberg Thorsen |
| Maintainers | kjellmorten |
| Keywords | json, integreat |

## Links

- npm: https://www.npmjs.com/package/integreat-adapter-json
- Repository: https://github.com/integreat-io/integreat-adapter-json
- Homepage: https://github.com/integreat-io/integreat-adapter-json#readme
- Issues: https://github.com/integreat-io/integreat-adapter-json/issues
- npm.io page: https://npm.io/package/integreat-adapter-json

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.4 (latest) — 2026-04-14
- 0.8.1 (v0_8) — 2026-04-14
- 0.4.2 (v0_4) — 2024-02-02
- 1.0.3 — 2025-07-16
- 0.8.0 — 2025-05-08
- 1.0.2 — 2025-04-03
- 1.0.1 — 2023-11-14
- 1.0.0 — 2023-08-04
- 0.7.1 — 2023-07-30
- 0.7.0 — 2023-07-04
- 0.6.0 — 2023-05-19
- 0.5.0 — 2023-04-24
- 0.4.1 — 2021-03-12
- 0.4.0 — 2021-01-15
- 0.3.8 — 2020-08-04
- … 17 more at https://npm.io/package/integreat-adapter-json/versions

## README

# JSON adapter for Integreat

Adapter that lets
[Integreat](https://github.com/integreat-io/integreat) parse and stringify JSON.

[![npm Version](https://img.shields.io/npm/v/integreat-adapter-json.svg)](https://www.npmjs.com/package/integreat-adapter-json)
[![Maintainability](https://qlty.sh/gh/integreat-io/projects/integreat-adapter-json/maintainability.svg)](https://qlty.sh/gh/integreat-io/projects/integreat-adapter-json)

## Getting started

### Prerequisits

Requires node v18 and Integreat v1.0.

### Installing and using

Install from npm:

```
npm install integreat-adapter-json
```

Example of use:

```javascript
import Integreat from 'integreat'
import httpTransporter from 'integreat-transporter-http'
import jsonAdapter from 'integreat-adapter-json'
import defs from './config.js'

const great = Integreat.create(defs, {
  transporters: { http: httpTransporter },
  adapters: { json: jsonAdapter },
})

// ... and then dispatch actions as usual
```

Example service configuration:

```javascript
{
  id: 'store',
  transporter: 'http',
  adapters: ['json'],
  options: {
    includeHeaders: true
  },
  endpoints: [
    { options: { uri: 'https://api.com/jsonApi' } }
  ]
}
```

Data headers for sending with content-type `application/json` will be set unless
you set the `includeHeaders` option to `false` (it's `true` by default). Headers
will be set where there is data, unless a content-type header is already set.
The case of the header will always be changed to `'Content-Type'`.

### JSON transformer

The package also includes a transformer, that works exactly like the adapter,
except it is intended for use in mutation pipelines with
`{ $transform: 'json' }`. You may use it like this:

Example of use:

```javascript
import integreat from 'integreat'
import httpTransporter from 'integreat-transporter-http'
import jsonTransformer from 'integreat-adapter-json/transformer.js'
import defs from './config.js'

const great = Integreat.create(defs, {
  transporters: { http: httpTransporter },
  transformers: { json: jsonTransformer },
})

// In a mutation pipeline:

const mutation = ['response.data', { $transform: 'json' }]
```

The `includeHeaders` option from the adapter, does not apply to the transformer.

### Running the tests

The tests can be run with `npm test`.

## Contributing

Please read
[CONTRIBUTING](https://github.com/integreat-io/integreat-adapter-json/blob/master/CONTRIBUTING.md)
for details on our code of conduct, and the process for submitting pull
requests.

## License

This project is licensed under the ISC License - see the
[LICENSE](https://github.com/integreat-io/integreat-adapter-json/blob/master/LICENSE)
file for details.

---
_Source: https://npm.io/package/integreat-adapter-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
