.Net 4.5/MVC/WebAPI RC and the missing JsonArray

 

Before the RC release of MVC4/WebAPI JsonArray and JsonObject lived in System.Runtime.Serialization.  Once you upgrade your project these options disappear.

The fix is pretty simple.  In the latest RC release of MVC4/WebApi Microsoft switched the JSON handler to JSON.NET

The project should have a reference to Newtonsoft.Json (if it does not, you might need to load the NuGet package.

Once this is complete add a using statement

using Newtonsoft.Json.Linq

After that you can now use:

  • JArray in place of JsonArray
  • JObject in place of JsonObject
  • so on and so forth.
Advertisements
This entry was posted in MVC, Web and tagged , , . Bookmark the permalink.

One Response to .Net 4.5/MVC/WebAPI RC and the missing JsonArray

  1. Mike Jones says:

    Thanks for the explanation. So far you’re the only place on the web to provide one.

Leave a Reply

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