Jul 102017

In this example i will printing out the list of movies that we get in the form of Json and print them out.

Step1: Create a console project

Step2: Add newtonsoft nuget package

Step3: I will be using a open source api that i will call to pint the title of the movie along with the release year. In this example i will print the movies which have the keyword beast in the title. So here is the code.


In the above code the variable text have the resulting json text. which looks like this

[ { “id”: “5628302”, “title”: “Beast (III)”, “year”: “2017”, “poster”: “N/A”, “type”: “movie” }, { “id”: “6414796”, “title”: “Beast (V)”, “year”: “2017”, “poster”: “N/A”, “type”: “movie” }, { “id”: “4261746”, “title”: “Beast (VIII)”, “year”: “2017”, “poster”: “N/A”, “type”: “movie” }, { “id”: “1365050”, “title”: “Beasts of No Nation”, “year”: “2015”, “poster”: “N/A”, “type”: “movie” }, { “id”: “1152398”, “title”: “Beastly”, “year”: “2011”, “poster”: “N/A”, “type”: “movie” } ]

To deserialize it I will cal the newtonsoft deserializer that will map the json values to my object MovieInfo and provide me with the converted list.

 Posted by at 10:38 am

Sorry, the comment form is closed at this time.