# jsonparser

> A JSON Parser for node http server

Latest version **1.0.1** (published 2017-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsonparser
pnpm add jsonparser
yarn add jsonparser
bun add jsonparser
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-01-03 |
| First published | 2014-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 6 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sharat M R |
| Maintainers | cosmosgenius |
| Keywords | jsonparser, middleware, express, json, parser |

## Links

- npm: https://www.npmjs.com/package/jsonparser
- Repository: https://github.com/cosmosgenius/jsonparser
- Issues: https://github.com/cosmosgenius/jsonparser/issues
- npm.io page: https://npm.io/package/jsonparser

## Dependencies (1)

- [type-is](https://npm.io/package/type-is.md) ^1.6.14

## 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.1 (latest) — 2017-01-03
- 1.0.0 — 2017-01-02
- 0.3.0 — 2017-01-02
- 0.2.0 — 2014-08-28
- 0.1.2 — 2014-08-28
- 0.1.1 — 2014-08-24
- 0.1.0 — 2014-08-24
- 0.0.3 — 2014-08-24
- 0.0.2 — 2014-08-24

## README

# jsonparser

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coverage-image]][coverage-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

Gets the whole content in the request as a json to the property json

### Install

```sh
$ npm install jsonparser
```

## API

```js
const jsonparser = require('jsonparser');
```

### jsonparser(options)

This middleware adds a `req.json` property which contains the JSON parsed request body

#### Options
- `strict` a truthy value to check for content type header (default: false).
- `type` request content-type to parse (default: json).
- `bodyCheck` a truthy value for empty body check (default: false).

## Example

```js
const bodyparser = require('simple-bodyparser');
const jsonparser = require('jsonparser');
const app = require('express')();

app.use(bodyparser());
app.use(jsonparser());
app.use(function(req, res, next){
    let body = req.json
});
```

## License

[MIT](LICENSE)


[npm-image]: https://img.shields.io/npm/v/jsonparser.svg?style=flat-square
[npm-url]: https://npmjs.org/package/jsonparser
[github-tag]: http://img.shields.io/github/tag/cosmosgenius/jsonparser.svg?style=flat-square
[github-url]: https://github.com/cosmosgenius/jsonparser/tags
[travis-image]: https://img.shields.io/travis/cosmosgenius/jsonparser.svg?style=flat-square
[travis-url]: https://travis-ci.org/cosmosgenius/jsonparser
[coverage-image]: https://codecov.io/gh/cosmosgenius/jsonparser/branch/master/graph/badge.svg
[coverage-url]: https://codecov.io/gh/cosmosgenius/jsonparser
[license-image]: http://img.shields.io/npm/l/jsonparser.svg?style=flat-square
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/jsonparser.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/jsonparser

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