I have LoginModel:
public class LoginModel : IData
{
public string Email { get; set; }
public string Password { get; set; }
}
and I hav
You can add the two following statement in the configuration of the web API or to the startup file
using Newtonsoft.Json; using Newtonsoft.Json.Serialization; GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Formatting = Formatting.Indented;
But it is very important to use the return Ok()
method instead of return Json()
otherwise; this will not work.
if you have to use Json method (and have no other choice) then see this answer https://stackoverflow.com/a/28960505/4390133