Using Json.NET to implement your own json serializer (ASP NET MVC)

Code! Code! Code!

When working with even the latest version of ASP NET MVC 4, there are times when you will need to return Json from you controllers.  In this case the framework utilizes the JavascriptSerializer. This is the default for ASP NET MVC unlike the ASP NET WEB API which uses Json.Net

Also worthy noting is that JsonValueProviderFactory uses the JavascriptSerializer to deserialize request body to action parameters.  My problems with JavascriptSerializer on ASP NET MVC  as follows:

1.  The date format that is returned: Most of the times I have come across this date format ( Date(1365850930898)).

2. Circular reference which is a common issue when working with Entity framework. Though there are work around for this like disable lazy loading, its not an ideal solution as lazy loading is one for main reason for the ORM like EF.

To solve all these related issue, JSON.NET comes into play as it has solution to…

View original post 128 more words

Advertisements

About Piusn

Enthusiastic Software Developer

What's your thought on the subject?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: