0

I'm using asp.net mvc4 and json.net

and i have a json structure like http://api.domaintools.com/v1/domaintools.com/whois/

How can i deserialize it into my own class ? This looks a bit complicated structure to me to realize how to build my class ?

Nam Vo

1 Answer 1

1

You can use the following class structure:

       public class Response
       {
          public string Registrant {get;set;}
          public Registration registration {get;set;}
          public WhoIs whois {get;set;}
       }
       public class Registration
      {
          public DateTime created {get;set;}
          public DateTime expires {get;set;}
          public DateTime updated {get;set;}
          public string registrar {get;set;}
          public List<string> statuses {get;set;}
          public List<string> name_servers {get;set;}

      }
      public class WhoIs
      {
          public DateTime date {get;set;}
          public string record {get;set;}

      }

You can then do like below:

    Response response = JsonSerializer.DeserializeFromString<Response>(data);//data is your data from the link you have given in the problem description

Thus the data is now deserialized into your own class Response...hope this helps....

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.