Web API 2: how to return JSON with camelCased property names, on objects and their sub-objects

Putting it all together you get… protected void Application_Start() { HttpConfiguration config = GlobalConfiguration.Configuration; config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false; }

Swagger UI Web Api documentation Present enums as strings?

Enable globally From the docs: httpConfiguration .EnableSwagger(c => { c.SingleApiVersion(“v1”, “A title for your API”); c.DescribeAllEnumsAsStrings(); // this will do the trick }); Enum/string conversion on particular property Also, if you want this behavior only on a particular type and property, use the StringEnumConverter: public class Letter { [Required] public string Content {get; set;} [Required] … Read more

FromBody string parameter is giving null

By declaring the jsonString parameter with [FromBody] you tell ASP.NET Core to use the input formatter to bind the provided JSON (or XML) to a model. So your test should work, if you provide a simple model class public class MyModel { public string Key {get; set;} } [Route(“Edit/Test”)] [HttpPost] public void Test(int id, [FromBody] … Read more