Specifiying the JSON Serializer Used

CallbackHandler by default uses an internal JavaScript serializer. However, you can use several different types of JSON serializers:

  • Westwind JSONSerializer
  • ASP.NET JavaScriptSerializer
  • JSON.NET

The default serializer doesn't add any dependencies and provides support for a host of types that the ASP.NET serializer doesn't do so well (ISO dates, Collections). JSON.NET is a great option if you application is already using that.

To use a custom JSON serializer you can use the following code in your Application_Start handler:

protected void Application_Start()
{
    **JSONSerializer.DefaultJsonParserType = SupportedJsonParserTypes.JsonNet;**  
    
    CallbackHandlerRouteHandler.RegisterRoutes<MyHandler>(RouteTable.Routes);
}


© West Wind Technologies, 1996-2016 • Updated: 12/19/15
Comment or report problem with topic