I am sending the JSON request to the Node.js API.
$.ajax({
url : url,
contentType: "application/json",
type: "POST",
data: {
"userId":1002,
"type":"from",
"actors": [1001],
"actual_amount":5.00,
"last_modified":1421480903128
},
success : function(data) {
//Success
},
error : function(err) {
//Error
}
});
Request Obj received in Node.API :
actors: "[1001]"
actual_amount: "5.00"
last_modified: "1421480903128"
type: "from"
userId: "1002"
var express = require('express');
var path = require('path');
var bodyParser = require('body-parser');
app.use(bodyParser.json({ type: 'application/*+json' }));
app.use(bodyParser.urlencoded({ extended: true }));
Please let me know how to resolve this. I am new to Node.js
JSON.stringify. Or are you experiencing a problem doing so?