How to Read/Parse JSON into C# Objects: Simple Example with QuickType and Visual Studio 2019 HD
Read data from a JSON feed into a series of C# objects. Start with a JSON data feed, possibly from a REST endpoint, and paste it into QuickType to generate a schema and client code. Then, create a new Visual Studio 2019 Core Web Project (C#). Create an empty class, named the same name as the QuickType class. Paste in the QuickType generated source, and provide a JSON feed to it (either locally or remotely, using WebClient). The QuickType generated class will read the JSON and create an object/array out of it. Next, we pass these objects to a .cshtml file, and render them, using [ViewData], a foreach loop, and an HTML table. We add a breakpoint so that you can visualize the JSON being transformed into C# objects. Source code for this project is freely available at: https://github.com/discospiff/ShowMeShortcuts
Похожие видео
Показать еще