title: JSON data to table using C# .Net MVC
body: <p>Hi guys I have the following JSON list</p>
  
  <pre><code>{
    "students": [{
      "Name" : "Robert Mcguffin",
      "Registered" : "2014-07-20 05:34:16",
      "Student No:" : 1
  } , {
      "Name" : "Agathe Dubois",
      "Registered" : "2014-05-30 09:46:26",
      "Student No:" : 2
  } , {
      "Name" : "Steven Corral",
      "Registered" : "2015-02-11 09:58:16",
      "Student No:" : 3
  }]
  }
  </code></pre>
  
  <p>I need to be able to publish the following data to a table in an mvc application.</p>
  
  <p>First and foremost I've done my research and it said that I should use deserialization with json.net so it makes an object list with the information supplied. Then I should use a view to publish the list to html.</p>
  
  <p>How do I do this and if I do it will I be able to search the list given above using a dropdown which specifies either Name, Registered or StudentNo and then displays the student that it searched for? I know how to implement the search using sql but not sure if I could search the list otherwise.</p>
  
  <p>Code for my Model</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace StudentApplication.Models
  {
         public class Students
      {
          public string Name {get; set;}
          public DateTime Registered {get; set;}
          public int StudentNo {get; set;}
      }
  
      public class StudentList
      {
          public List&lt;Students&gt; students {get; set;}
      }
  }
  </code></pre>
  
  <p>Code for my controller</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  
  namespace StudentApplication.Controllers
  {
      public class UserController : Controller
      {
          [HttpGet]
          public ActionResult List()
          {
  
              var resolveRequest = HttpContext.Request;
              List&lt;Students&gt; model = new List&lt;Students&gt;();
              resolveRequest.InputStream.Seek(0, SeekOrigin.Begin);
              string jsonString = new StreamReader(resolveRequest.InputStream).ReadToEnd();
              if (jsonString != null)
              {
                  JavaScriptSerializer serializer = new JavaScriptSerializer();
                  model = (List&lt;Students&gt;)serializer.Deserialize(jsonString, typeof(List&lt;Students&gt;);
              }
              return View();
          }
      }
  }
  </code></pre>
  
  <p>I got that last bit of code from <a href="https://stackoverflow.com/questions/19291530/how-to-send-json-string-to-controller-in-mvc4-and-deserialize-json">How to Send Json String to Controller in mvc4 and Deserialize json</a></p>