NodeJS server changing keyname of JSON Object
It's because your json data is urlencoded. In order for it to be parsed into a rich json object you have to use a special library to do so.
Here's how to do it with the body-parser package:
const bodyParser = require('body-parser');app.use(bodyParser.json())app.use(bodyParser.urlencoded({ extended: true }));
Difference it makes:
-- with: bodyParser.urlencoded({ extended: true }) --{ profileType: '', location: [ 'ayush', 'hehehe' ], centerPref: '0' }-- with: bodyParser.urlencoded({ extended: false }) -- { profileType: '', 'location[]': [ 'ayush', 'hehehe' ], centerPref: '0' }