1

I am trying to convert my .NET 4.0 class library to Windows Phone 8 class library to use it in my app. It turns out to be there is no JavaScriptSerializer available in Windows Phone 8 SDK. I am actually trying to deserialise my HttpClient response to my class object. How can I achieve that using windows phone 8 SDK.

Below is the code that I used in my .NET Class library

var serializer = new JavaScriptSerializer();
var dataObject = serializer.Deserialize<MyResponseClassObject>(result);
return dataObject;

Thanks,

PushCode
  • 1,419
  • 3
  • 15
  • 31

1 Answers1

2

You could use JSON.NET instead of JavaScriptSerializer: it has better performance and supports .NET 2, .NET 3.5, .NET 4, Silverlight and Windows Phone.

Here is the equivalent of your code with JSON.NET:

var dataObject = JsonConvert.DeserializeObject<MyResponseClassObject>(result);
return dataObject;
Olivier Payen
  • 15,198
  • 7
  • 41
  • 70
  • Oh...I didn't know that. Thanks for the quick reply. I looked at its documentation and it should solve my problem. – PushCode Aug 13 '13 at 21:40