I am trying to send an json object to my apiController :
myJson Object that I construct dynamicaly like this :
var course= new Object();
course.info= $scope.info;
course.studentList = [];
course.studentList = $scope.results;
$scope.results is an array that I get from my view :
<select ng-model="results[$index]" >
<option value=""></option>
<option ng-repeat="r in myList" value={{r}}>{{r.studlastname}}</option>
</select>
what I expect :
{
"course": {
"courseName":"yyy",
"courseDesc":"xxxx",
"prof":"prof1"
},
"studentList" :[
{"studfirstname":"2","studlastname":"","studAge":"21"},
{"studfirstname":"4","studlastname":"","studAge":"40"},
{"studfirstname":"6","studlastname":"","studAge":"60"}
]
}
what I have :
{
"course": {
"courseName":"yyy",
"courseDesc":"xxxx",
"prof":"prof1"
},
"studentList" :[
"{"studfirstname":"2","studlastname":"","studAge":"21"}",
"{"studfirstname":"4","studlastname":"","studAge":"40"}",
"{"studfirstname":"6","studlastname":"","studAge":"60"}"
]
}
notice the quotations on every studentList element, this is causing deserialization problem on server side.
please can you help me to remove the quotations ?
thank you in advance.