In angular 4 at a client side, i have a post method when i click on it ->
var json=JSON.stringify({id:"1",name:"par",title:"ssss"});
var params='json'+json;
this.http.post("http://localhost:3000/users/insertData",params, optio
.subscribe(res => console.log(res.json()));}
after click on this at server side, I am using node express js, so the problem at server side I am getting data that type which is not acceptable for the database my SQL so data is getting ->
{ 'json{"id":"1","name":"par","title":"ssss"}' : ' ' }
but I want to get data is ->only JSON form
{"id":"1","name":"par","title":"ssss"}
so please give me some solution ...
This line:
var params='json'+json;
You are concatenating a string with some data in JSON form.
I am not sure what you are trying to do with that, but that is why the data is not JSON when you receive it on the back end.