Express received json data with post in the wrong format?

  node.js, question

Today’s test found that when I used node’s request module to send json data to express server, express accepted the wrong data format.

The data I transmitted

bracket
 'commodityList': [
 bracket
 CommodityName',' Tenga Cup',
 'commodityId': '2',
 'commodityPrice': 128,
 'commodityNumber': 2
 },
 bracket
 CommodityName':' slippers',
 'commodityId': '1',
 'commodityPrice': 59,
 'commodityNumber': 10
 bracket
 ],
 'purchasePrice': 846,
 'userId': '1'
 bracket

Data received by express

{'Commodity List [0] [Commodity Name]':' Tenga Cup',
 'commodityList[0][commodityId]': '2',
 'commodityList[0][commodityPrice]': '128',
 'commodityList[0][commodityNumber]': '2',
 Commodity list [1] [commodity name]':' slippers',
 'commodityList[1][commodityId]': '1',
 'commodityList[1][commodityPrice]': '59',
 'commodityList[1][commodityNumber]': '10',
 purchasePrice: '846',
 userId: '1'
 bracket

I can’t get the data like this

Related codes

Client request sends data

var request = require('request');

var options = {
    url: 'http://localhost:3000/commodityManage/purchaseAdd',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    },
    form: {
        'commodityList': [
            {
                'commodityName': '飞机杯',
                'commodityId': '2',
                'commodityPrice': 128,
                'commodityNumber': 2
            },
            {
                'commodityName': '拖鞋',
                'commodityId': '1',
                'commodityPrice': 59,
                'commodityNumber': 10
            }
        ],
        'purchasePrice': 846,
        'userId': '1'
    }
};

console.log(options.form.commodityList);

console.log(options.form.commodityList.length);

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        var info = JSON.parse(body);
        console.log("info:", info);
    }
}

request.post(options, callback);

The server receives data

router.post('/purchaseAdd', function(req, res, next) {
 var uploadData = req.body;
 console.log(uploadData);
 bracket

Seek a solution

You may need a bodypraser to help parse the json you post.