jsonparser
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

jsonparser

NPM version Build status Test coverage License Downloads

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

Install

$ npm install jsonparser

API

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

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

/jsonparser/

    Package Sidebar

    Install

    npm i jsonparser

    Weekly Downloads

    115

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • cosmosgenius