You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By using Json.NET, DirectHandlerInterceptor allow great flexibility on JSON serialization. To customize how Json.NET serialize/deserialize method parameters you can procede as follows:
public class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
...
DirectHttpHandler.SetDirectHandlerInterceptor(delegate(Type type, MethodInfo method, DirectHandlerInvoker invoker) {
var jsonSerializer = new JsonSerializer {
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
jsonSerializer.Converters.Add(new MyCustomJsonConverter()); // Example of custom JSON converter
invoker.Invoke(jsonSerializer: jsonSerializer);
});
...
}
}