1

I have the following snippet of code. This is for an assignment and I'm not understanding what it is that is happening here. I'm supposed to create a styled list using the following:

{
  "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
}]}

I'm not sure what's going on here but I'm assuming it's a list inside an array. I'm not even sure that's possible. How would I declare this in MVC? If it's not a list inside an array then what is going on here?

Please help and thank you in advance.

6
  • It is not list inside an array, it called JSON string. Commented Jul 25, 2015 at 0:34
  • Thank you so much. It's really going to help me finish this assignment. Commented Jul 25, 2015 at 0:37
  • It an object (with a property students) which is an array/collection containing 3 objects with properties Name, Registered and Student No Commented Jul 25, 2015 at 1:05
  • 1
    Its an array of objects in json. What is it that you want to do with it? In mvc you can return this from an action method. Create a 'list<student>() lst' and the return json(new { students = lst } ); Commented Jul 25, 2015 at 1:59
  • 1
    Thank you pasty I will ask a different question. I did not know that I couldn't change my question. Commented Jul 25, 2015 at 22:22

1 Answer 1

1

What you see there is a JSON string with a List of Student Objects. Those Student objects have the properties Name, Registered and StudentNo.

Use this, so you can start making some parallelism between a JSON string and C# classes. Change the string and play a bit with it :)

http://json2csharp.com/

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.