Facebook C# SDK v5 RC

Yups. We are moving away from the beta tag to RC. Finally we (Facebook C# SDK devs) can start talking about the exact date for RTW.

What does v5 RC mean?

The RC version will lock down all the codebase and features. This means we will not be adding/removing any features for the v5 RTW. Any new features requested from now will be moved to the version after v5 RTW. Some of you might be thinking why yet another pre-release code instead of RTW. Well… since this release includes a brand new lightweight json library called SimpleJson we wanted to give users one more week to try out and report any bugs before we hit the RTW. If everything goes fine you should expect the v5 RTW to be available for download in the first week of May. (If there are no bugs reported RC will be renamed to RTW.)

Most of you have been asking questions on the stable release date. So here it is …

Core reason for delaying the RTW was to incorporate the new json library in the SDK. Now that we have completed writing SimpleJson, you can expect the RTW to be released soon. (We wanted to ship the new json library before the RTW so we could avoid breaking changes for future releases). Starting from v5.0.8 beta we had commented that these releases are production ready.)

Here are some notes on why we shifted to SimpleJson:

When I first tweeted and wrote a message on the Facebook C# SDK group about a new Json Library for .NET called “SimpleJson” which will be replacing the default serializer - Newtonsoft.Json, the questions that came on minds first were - “why do we need new json library?”, “was it worth it?”, “what is wrong with such a well respected library such as Json.Net that we need another one?”. Hopefully this post will clarify these questions.

“What is wrong with such a well respected library such as Json.Net”

Actually there is nothing much wrong with Json.Net or any json libraries around in the .net world. Different users have different taste. There was just some stuffs that didn’t go well with Json.Net as we wanted too with Facebook C# SDK. Especially on how dynamic is implemented. I had actually brought up this discussion on the Json.Net codeplex’s site about implementing IDictionary<string,object> and IList<object>. If you look at the v5.0.9 or earlier source code of Facebook C# SDK serializer you will notice that once Json.Net deserializes we need to loop again through the deserialized data and copy it to JsonObject or JsonArray (Yups. The sdk had been hiding the cool dynamic implementation internally all the way long and making your life easier. You can look at the JsonSerializer.cs and you will notice the method called ConvertJTokenToDictionary). There are other reasons too which I will explain shortly.

“Why do we need new json library?”

Even long before I joined as a developer in Facebook C# SDK I had always been looking for a new JSON library in .net that is lightweight. Here is the proof - https://github.com/RestSharp/RestSharp/issues/39 (I posted this issue on July 2010).

I think (personally) like me there are actually a quite a lot of devs who want to use a new lightweight json parser but hasn’t yet found one. So one of the thing we needed to address was small size. Do we really need a 330k sized library to parse something that is so simple as JSON? (As of this posting, the current size of SimpleJson is around 1.5k lines. Actually the core is more less than this. It due to lot of #if define directives that it looks a bit longer.)

As for Facebook C# SDK, we don’t need to use Linq To Json. It was thus better to go for a more lightweight Json library that removes all the unwanted stuffs. (It is great to have all these cool features, but do we really use it?)

“was it worth it?”

We (Facebook C# SDK devs) never thought that we would actually land up writing our own json library first.

Before writing SimpleJson, we tried to find all the C# json parser libraries around. There were 12 .net json parsers around that time in http://json.org/ In the end we landed up taking one of the libraries mentioned from json.org (How do I write my own parser? (for JSON)). SimpleJson is actually a fork, not a totally new JSON parser around. Luckily not much work for us :-)

SimpleJson and Facebook C# SDK updates

Starting from v5.0.10, we will not be supporting Json.Net out of the box, but for compatibility reasons for those migrating, we will continue to provide the Json.Net serializer for Facebook C# SDK for few weeks. (We will not be updating the serializer to support new versions of Json.Net and highly recommend you to use the new built in SimpleJson that comes with the SDK. The only reason you might want to use Json.Net is if you are upgrading from previous versions and are using strongly typed objects. Incase you are starting a new project you can use SimpleJson which is capable of serializing/deserializing strongly typed POCO and DataContract classes.)

SimpleJson seems cool, but I want Json.Net

No worries. We don’t dictate which json library best works for you. If you want to continue to use Json.Net you are free to use it (or even any other json libraries around).

Facebook C# SDK easily allows you to change the default serializer.


Implement the IJsonSerializer interface and you can plug your favorite Json library.

If you then decide to revert back to the default json serializer of Facebook C# SDK – SimpleJson, pass null.


It is highly recommend that you change the serializer only when the application starts and stick with it through out the application lifetime.

SimpleJson beyound Facebook C# SDK

One thing you might have noticed is SimpleJson is a totally new project which can be found at http://simplejson.codeplex.com. This means you can embed it in your own projects too. We think you can benefit from SimpleJson the same way as we do with Facebook C# SDK. So start by forking the project and contributing patches to the project. SimpleJson is also available as a NuGet package. Install-Package SimpleJson (We very much want the open source community to drive this project.)