I have a problem with sending my JSON object via angularjs' $http.put method.
When I used to send JSON containing only String there was no problem, but now I want to send ints and one int array and I can't get them matched(java class that is going to be mapped with JSON).
$scope.edit = function(game, goalScorersHome, goalScorersAway) {
var JSONScore = {
'id' : game.id,
'idHome' : game.homeId,
'idAway' : game.awayId,
'goalsHome' : game.goalsHome,
'goalsAway' : game.goalsAway,
'goalScorers' : []
};
for(i=0;i < goalScorersHome.length; i++) {
JSONScore.goalScorers.push(goalScorersHome[i].id);
}
for(i=0;i < goalScorersAway.length; i++) {
JSONScore.goalScorers.push(goalScorersAway[i].id);
}
$log.log(JSONScore);
fixturesService.editScore(game.id, game.homeId, game.awayId, JSONScore);
This is where I send my JSON. 'Goalscorers' has to be long[] type. And on the REST Server I have class(Score.java) with
private int id;
private int goalsHome;
private int goalsAway;
private int idHome;
private int idAway;
private long[] goalScorersId;
So when I send it I have this message given: PUT http://localhost:9000/push-server/rest/season/1/1/2 500 (Internal Server Error)angular.js:8495 (anonymous function). I'm only asking for help how to map this JSON object(JSONScore to java class. When I pass Strings it works!! This is how this JSON looks like JSONScore image