tags:

views:

39

answers:

1

I have a control that expects JSON in a particular format. I have a service that spits out JSON in a different format. What's the best way to convert the JSON to the expected format? C#, jQuery? I think I'd prefer to do it server-side.

A: 

With C# you can use System.Web.Script.Serialization.JavaScriptSerializer to parse your JSON string to an object or IDictionary.

MSDN: JavaScriptSerializer Class (System.Web.Script.Serialization)

With that object you could do anything you like, change values or maybe just parse it back to something like XML.

Peter Kiers