Linked Questions

117 votes
9 answers
107k views

UPDATE Thanks for all the answers. I am on a new project and it looks like I've finally got to the bottom of this: It looks like the following code was in fact to blame: public static ...
Tom's user avatar
  • 8,200
110 votes
4 answers
34k views

I have a Web Api project being configured like this: config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); However, I want dictionary ...
zafeiris.m's user avatar
  • 4,509
44 votes
3 answers
39k views

Overriding the default JSON serializer settings for web API on application level has been covered in a lot of SO threads. But how can I configure its settings on action level? For example, I might ...
Johan's user avatar
  • 35.4k
17 votes
3 answers
49k views

When I deseiralize the JSON to the C# object below, either using Newtonsoft explicitly or via the model binding mechanism of ASP.NET Web Api, the string id value is automatically converted to int. I ...
John L.'s user avatar
  • 1,971
15 votes
1 answer
23k views

I'm deserializing an object using Json.NET that contains a private field of type Guid and a public property for that field. When the value for my Guid is null in my json I want to assign Guid.Empty to ...
Adrian Buzea's user avatar
11 votes
2 answers
6k views

Watching this video on json deserialization attacks and it shows this bit of json that can be used to trigger arbitrary code execution on any application that deserializes it. Now in my applications, ...
George Mauer's user avatar
4 votes
2 answers
5k views

I am calling a WebApi controller Get method from an Angularjs service. The angular service: app.service('MyService', ['$http', function ($http) { var getMyObjects = function () { var ...
Declan McNulty's user avatar
4 votes
2 answers
4k views

public Guid AddJobs(JObject parametrs) { dynamic jsonParameters = parametrs; JobViewModel job = jsonParameters.Job.ToObject<JobViewModel>(); } Above is my code. I am trying to ...
Safi Mustafa's user avatar
1 vote
2 answers
4k views

Json.Net is not deserializing the object it receives into the proper derivatives of my Control class. (Please see the following explanation of the problem. Also please note, I feel this is the minimum ...
Targaryen's user avatar
  • 1,091
5 votes
1 answer
2k views

In my project, I have written a custom json converter to trim the white-spaces present in the string property. Here is an example of the typical class we will use, public class Candidate { ...
dks's user avatar
  • 171
2 votes
1 answer
3k views

I have a Web Api Controller as shown below public class HomeController : ApiController { .... [HttpPost] [Route("api/Add")] public IHttpActionResult Add(Employee emp) { ......
Saanthosh's user avatar
2 votes
1 answer
3k views

When submitting a JSON body to an MVC application I get the following exception during binding: An item with the same key has already been added. This happens when a HTTP body has 2+ JSON properties ...
AndySavage's user avatar
  • 1,769
1 vote
2 answers
3k views

I tried tro return date in ISO format using Json.Net from ASP.NET MVC4 controller public JsonResult Sales() { var saleList = new List<Sale>(); ... var str = JsonConvert....
Andrus's user avatar
  • 28.2k
2 votes
2 answers
2k views

In my last SO question, I asked how to modify the serializer settings for Json.NET, which ASP.NET Web API natively uses for (de)serialization. The accepted answer worked perfectly, and I was, for ...
Richard Neil Ilagan's user avatar
2 votes
1 answer
1k views

I have the error in the title when a try to call webApi. This is my class: public class NotificationDTO { public long idCompanyService { get; set; } public DocTypeEnum DocumentType { get; ...
ricga's user avatar
  • 79

15 30 50 per page