Parth Doshi Parth Doshi - 1 year ago 176
JSON Question

Parse JSON String to JSON Object in C#.NET

I have a JSON String returned by my SOAP web service in .NET. It is as follows:


Now I want to parse this string to a JSON Object. I also read this where they have used this line of code:

JObject jsonObj = JObject.Parse(json);

So can I do the same by replacing "json" with my string name. Also do I need to reference any other dll except the NewtonSoft.dll ?

BTW, Here is the full webservice code

Answer Source

use new JavaScriptSerializer().Deserialize<object>(jsonString)

You need System.Web.Extensions dll and import the following namespace.

Namespace: System.Web.Script.Serialization

for more info MSDN

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download