Answer the question
In order to leave comments, you need to log in
Why is AngularJS sending invalid JSON to the server?
I am using AngularJS in my project.
Question 1. I make a request like:
$scope.user.id = 31;
$scope.user.name = "Vladimir";
$http.post(url, $scope.user);
{ id:31, name="Vladimir" }
{ "id":31,"name"="Vladimir" }
$http.post(url, angular.toJson($scope.user));
$scope.user = Restangular.one("user", 31);
$scope.user.name = "Vladimir";
$scope.user.patch();
{ id:31, name = "Vladimir" }
{ "user": {"name"="Vladimir", "id"=31 }}
Answer the question
In order to leave comments, you need to log in
The only correct format is:
json.org/example
Try using the stable version of Angular
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question