views:

123

answers:

2

I have a bunch of little JSON object fragments of the form:

{ id: "wow", foo: 45.4, bar: "hello, world!" }

By "a bunch" I mean about 6 GB worth. :-) (And yes, I know, this isn't technically JSON. The full story is that it originally came from YAML data, but I find that most "JSON" parsers can handle this subset of YAML just fine.)

Currently, I use Netonsoft's JSON parser with the line:

var obj = Newtonsoft.Json.Linq.JObject.Parse(json);

This works well for me, but I am porting my WinForms app to Silverlight 3.0 (and onward to 4.0 once I get the chance).

From Googling around, I see that there is some "DataContractSuperJavaScriptExSerializer2" library from Microsoft that does JSON parsing.

Should I use that library, or is there something better on the horizon? I'm 30 mins away from writing my JSON parser so that I can ensure that it is efficient, but I thought I would see if there is anything else worth looking at in the Silverlight 3 world.

+1  A: 

Add a referece to System.Json and System.Runtime.Serialization.Json

#using System.Json;

using (var reader = new StringReader(jsonText))
{
    var response = JsonValue.Load(reader) as JsonObject;

    /// parse your code here
}
Michael S. Scherotter
Thank goodness for that!
Frank Krueger
A: 

I have developed two views in Silverlight and currently using WCF services to take data (around 10 MB) from Server to Silverlight view. Even though there is no processing at server side and server is taking less than 1 sec from request recieve to response return but I am getting response in Silverlight after 50 sec. I have deployed WCF service in IIS and enabled HTTP compression which improve response time from 50 sec to 30 sec but still it is not acceptable.

Now I am thinking to move from WCF to JSON if it improve response time. Will it help me to improve response time?

Irfan