I have an ASP.NET Web API service that accepts JSON data. It works perfectly for all of our JSON data types except for one. Users are able to send inspection results from their mobile devices. The inspection results are received by an ASP.NET Web API service as JSON.
I have unit tests written in C# that are able to send inspection JSON data without a problem. But whenever I send the data from a web page the JSON data that is sent seems to be getting truncated.
This is what is sent.
{"Formname":"inspection","Formdata":{"UserId":1011357,"InspectionId":40013,"VehicleReg":"AA123ABC","Results":[{"QuestionId":100053,"OptionId":30192,"OptionResponse":"fantastic"}]},"Profile":{"EmailAddress":"[email protected]","OscarId":"1011369"}};
This is what is received.
{"Formname":"inspection","Formdata":{"UserId":1011357,"InspectionId":40013,"VehicleReg":"AA123ABC","Results":[{"QuestionId":100053,"OptionId":30192,"OptionResponse":"fantastic"
It's getting truncated at a length of 254.
Here is the AJAX that creates the request.
var url = "http://mywebservice/api/routingtasks?formname=inspection";
$.ajax({
type: "POST",
url: url,
contentType: "application/json",
headers: { "Authorization" : "TESTUSER " + signedToken},
data: JSON.stringify(formdata),
success: function(data){
alert("Task successfully processed.");
},
error: function(error){
alert("error: " + JSON.stringify(error));
}
})
The signature of the Web API controller that receives the JSON data is this.
public HttpResponseMessage RoutePostData(string formname, [FromBody] JToken postdata)
My C# unit tests are able to send the same JSON data without a problem, but sending the JSON data from a web page is causing a problem.