Arnt Gulbrandsen
About meAbout this blog
2012-07-26

An aside on Json.net and the Xbox 360

Json.net is a fine library. High DWIM factor. So I was happy when Microsoft suggested that I use Json.net instead of the class Microsoft had previously suggested as the best-supported, JavascriptSerializer.

Starting with the July 2012 release, the Xbox ADK contains an integrated version of Json.net. Unfortunately it seems dynamic types don't work on the Xbox 360, so they removed all the dynamic parts of JSON (ie. JS and most of the O).

Thus, for using Json.net on the Xbox, the following three rules apply: Use using Json.Net.Adk; instead of the proper package name. Use only JsonTextReader and its helpers (JsonToken, IJsonLineInfo) to parse. Use printf to write JSON.

Should you feel tempted to use json.net's excellent higher-level functionality, forget it. It's not there. The Microsoft Help page spends six sentences describing json.net, and that really is everything you can use.

I do wonder why dynamic doesn't work, and why that and the lack of the Microsoft.Csharp assembly isn't documented.