First, this has been asked a number of times but having read all the posts I found none provided an answer that fixed my particular scenario.
Also, please forgive any incorrect terminology as I may be misusing terms...
I am trying to take the JSON from this query and simply output to a textblock:
http://www.imdb.com/xml/find?json=1&nr=1&nm=on&q=jeniffer+garner
Which produces this:
{
"name_approx":[
{
"id":"nm0004950",
"title":"",
"name":"Jennifer Garner",
"description":"Actress, Dallas Buyers Club"
},
//more code
{
"id":"nm3144518",
"title":"",
"name":"Jennifer Varner",
"description":"Self, THS Investigates: Hot for Student"
}]}
The code I'm trying to use for this as follows.
Classes:
public class Movie
{
public List<Stream> name_approx { get; set; }
public Movie ()
{}
}
public class Stream
{
public string id { get; set; }
public string title { get; set; }
public string name { get; set; }
public string description { get; set; }
public Stream ()
{}
}
and...
searchOutput.Text = "";
searchStatusOutput.Text = "Awaiting Response...";
string userURI = inputAddress.Text;
var response = await httpClient.GetAsync(userURI);
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync();
Movie output = JsonConvert.DeserializeObject<Movie>(content);
//searchOutput.Text = ??????
When I run this I can see that Movie Output correctly contains one 'name_approx' object and nested within it 20 'Streams' as I expect.
I cannot however figure out how to output this to my text block. I've tried numerous approaches and think I need to use some form of foreach however I'm stuck and cannot work it out.