-
Notifications
You must be signed in to change notification settings - Fork 11
Customize JSON serialization
gimmi edited this page Mar 15, 2012
·
1 revision
public class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
...
DirectHttpHandler.SetDirectHandlerInterceptor(delegate(Type type, MethodInfo method, DirectHandlerInvoker invoker) {
invoker.Invoke(jsonSerializer: BuildJsonSerializer());
});
...
}
private static JsonSerializer BuildJsonSerializer()
{
var ret = new JsonSerializer {
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
ret.Converters.Add(new IsoDateTimeConverter());
// You freely configure JSON.NET serializer. For reference see http://james.newtonking.com/projects/json/help/
return ret;
}
}