C# .net how to deserialize complex object of JSON

I have a JSON string and I need some help to deserialize it.

nothing worked for me.. this is the JSON

{
"response": [
    {
     "loopa": "81ED1A646S894309CA1746FD6B57E5BB46EC18D1FAff",

     "drupa": "D4492C3CCE7D6F839B2BASD2F08577F89A27B4ff",

     "images": [

         {

         "report": {

         "nemo": "unknown"

    },

      "status": "rock",

      "id": "7e6ffe36e-8789e-4c235-87044-56378f08m30df",

      "market": 1

},

   {

"report": {

"nemo": "unknown"

},

"status": "rock",

"id": "e50e99df3-59563-45673-afj79e-e3f47504sb55e2",

"market": 1

   }

  ]

 }

]

}

i have an example of the classes but i don't have to use those classes, i don't mind using some other classes. these are the classes:

public class Report
{
    public string nemo { get; set; }
}

public class Image
{
    public Report report { get; set; }
    public string status { get; set; }
    public string id { get; set; }
    public int market { get; set; }
}

public class Response
{
    public string loopa { get; set; }
    public string drupa{ get; set; }
    public Image[] images { get; set; }
}

public class RootObject
{
    public Response[] response { get; set; }
}

I want to mention that i have Newtonsoft.Json already so i can use some functions from there.

how can I do this? thanks.

Answers


I am using like this in my code and it's working fine

below is a piece of code which you need to write

using System.Web.Script.Serialization;

JavaScriptSerializer oJS = new JavaScriptSerializer();
RootObject oRootObject = new RootObject();
oRootObject = oJS.Deserialize<RootObject>(Your JSon String);

Need Your Help

How to join two columns and use like clause for joined columns?

php codeigniter join like

Currently I'm making a search page with CodeIgniter. The problem I'm facing is that I have two columns in my products table, brand and model. I'm trying to select the results based on the query whi...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.