Sending JSON data from angularjs to nodejs
<p>I having a problem in sending json data from front end angularjs to express nodejs. Here is what i have tried. </p>

<p><strong>frontend.html</strong> page</p>

<pre><code>&lt;form ng-submit="func()"&gt;
    &lt;textarea name="inputtext" type="text" ng-model="sentence"&gt;&lt;/textarea&gt;
&lt;/form&gt;
</code></pre>

<p><strong>backend.js</strong> page</p>

<pre><code>$scope.func = function(){

 $scope.jsondata = {"status":"OK","language":"english","sentences":[{"sentence":"That's a nice restaurant."},{"sentence":"Also I went to another bad restaurant."},{"sentence":"I didn't like that movie."}]}

 $http.post('/sample',$scope.jsondata).success(function(data,status){
        console.log("Success");
     })
}
</code></pre>

<p><strong>server.js</strong></p>

<pre><code>var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var bodyParser = require('body-parser');
var path = require('path');
var fs = require('fs');

app.set('views', __dirname + '/views');
app.set('view engine' , 'ejs');

app.use(bodyParser.json());
var urlencodedParser = bodyParser.urlencoded({ extended: true });

app.use(express.static('public'));

app.get('/',function(req,res){
    res.render('index',{ title: 'Sentence' });
});
app.post('/sample',urlencodedParser,function(req,res){
    console.log(req.body);
});
http.listen(8888, function(){
   console.log("Server listening on 8888");
});
</code></pre>

<p>I am not getting exact JSON in the node server part. This is what i am getting.</p>

<p><strong>output</strong></p>

<pre><code>{ '{"status":"OK","language":"english","sentences":': { '{"sentence":"That\'s a nice restaurant."},{"sentence":"Also I went to another bad restaurant."},{"sentence":"I didn\'t like that movie."},{"sentence":"Thats a very bad movie."}': '' } }
</code></pre>

<p>Can any one help, how can i get exact json in the node server part. So that i can parse and write only sentence field into a file. </p>