skynyrd
11/12/2016 - 5:21 PM

Manipulating json behaviour in .NET Core application

Manipulating json behaviour in .NET Core application

services.AddMvc()
      .AddJsonOptions(o =>
      {
          if (o.SerializerSettings.ContractResolver != null)
          {
              var castedResolver = o.SerializerSettings.ContractResolver
                  as DefaultContractResolver;

              // Manipulate json behaviour here.
              castedResolver.NamingStrategy = null;
              }
      });