Skip to content

Instantly share code, notes, and snippets.

@jackinf
Created February 15, 2015 07:27
Show Gist options
  • Save jackinf/60cf7742d2539f18bde0 to your computer and use it in GitHub Desktop.
Save jackinf/60cf7742d2539f18bde0 to your computer and use it in GitHub Desktop.
Для того, чтобы данные с сервера приходили в удобном для javascript camelCase надо добавить следующий код в Startup.ConfigureServices
services.AddMvc().Configure<MvcOptions>(options =>
{
options.OutputFormatters
.Where(f => f.Instance is JsonOutputFormatter)
.Select(f => f.Instance as JsonOutputFormatter)
.First()
.SerializerSettings
.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment