Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

json.net how do i load a .json file into object

$
0
0

I am using the following just to test json in xamrian how do i load an entire file into a object for json .net

Course course = new RootObject { screen_id = "Bob", screen_id="test"}; // instead of this line i want it to come from file.json
        string output = Newtonsoft.Json.JsonConvert.SerializeObject (course);
        Console.WriteLine (output);
        Console.WriteLine();

        course = Newtonsoft.Json.JsonConvert.DeserializeObject<Course> (output);
        Console.WriteLine ("{0} - {1}",course.screen_id, course.screen_title);

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>