Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cosmosgenius/jsonparser
A JSON Parser for node server
https://github.com/cosmosgenius/jsonparser
http json middleware parser
Last synced: 20 days ago
JSON representation
A JSON Parser for node server
- Host: GitHub
- URL: https://github.com/cosmosgenius/jsonparser
- Owner: cosmosgenius
- License: mit
- Created: 2014-08-23T22:53:31.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-07T10:55:37.000Z (almost 8 years ago)
- Last Synced: 2024-10-09T06:31:13.246Z (about 1 month ago)
- Topics: http, json, middleware, parser
- Language: JavaScript
- Size: 62.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsonparser
[![Greenkeeper badge](https://badges.greenkeeper.io/cosmosgenius/jsonparser.svg)](https://greenkeeper.io/)
[![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