I hope someone can help me: My challenge is, that I have a web service returning a json.
The format is
{"stations":[{"name":"aname","free":false},{"name":"anothername","free":true}]}
so I have one object which is an array that hold n objects with n attributes....
Now for each object in that array of the stations object I would like to render the attributes, like
<p>stations[0].name</p>
I need to use this in mvc. So I created a model
public station(){}
public string name {get; set;}
public boolean free {get; set;}
in my contorller I use a WebClient and now I need to handle the response. I was thinking of IEnumerable but I don't know how to put this in the view?!
my goal is to understand how i can do something like
public Actionresult Stations(){
var stations = JObject.Load(reponse);
return View(Stations);
}
but I have no idea how to the handle each object of the array and get their values in the Stations.cshtml view using for each or similar....
Any idea?