title: Error: invalid json with multer and body-parser
body: <p>I am currently using <a href="https://github.com/expressjs/multer">multer</a> for <code>multipart/form-data</code> in node.js application alongside with <a href="https://github.com/expressjs/body-parser">body-parser</a>.</p>
  
  <p>I tried to <strong>POST</strong> form-data using POSTMAN, but it is getting this error.</p>
  
  <pre><code>Error: invalid json
      at parse (/Users/k/Documents/application/node_modules/body-parser/lib/types/json.js:79:15)
      at /Users/k/Documents/application/node_modules/body-parser/lib/read.js:102:18
      at IncomingMessage.onEnd (/Users/k/Documents/application/node_modules/body-parser/node_modules/raw-body/index.js:136:7)
      at IncomingMessage.g (events.js:199:16)
      at IncomingMessage.emit (events.js:104:17)
      at _stream_readable.js:908:16
      at process._tickDomainCallback (node.js:381:11)
  </code></pre>
  
  <p>This is how I added multer and body-parser in my server.js</p>
  
  <pre><code>var express = require('express');
  var mongoose = require('mongoose');
  var bodyParser = require('body-parser');
  var multer = require('multer');
  
  var app = express();
  
  app.use(bodyParser.urlencoded({extended: true}));
  app.use(bodyParser.json());
  app.use(multer({ dest: './uploads/'}));
  </code></pre>
  
  <p>I think it is probably because multer is not working. When I remove body-parser and try again, it shows empty json for <code>console.log(req.body)</code> and <code>console.log(req.files)</code>.</p>
  
  <p>Note: <code>body-parser</code> version is <strong>1.12.0</strong> and <code>multer</code> version is <strong>0.1.8</strong>.</p>