Creating a C# class from JSON.

Previously to create a C# class from JSON, we would use some tool, either web based or otherwise to generate the C# class. Now we have an option to generate an C# class directly from Visual Studio using the menu option Edit --> Paste Special --> Paste JSON as Classes.
Steps to implement this.
1. Copy the JSON that we to use to generate the C# class

2. Create a new C# class
2. Click on the menu option Edit --> Paste Special --> Paste JSON as Classes

3.We can see the C# class created. You might have to change some of the data types as at times, the date and integer properties are generated as string.
Hope this helps.

Popular posts from this blog

Print from WPF using ReportViewer Control

Printing SSRS 2008 R2 Reports from C#.

Using IOptions class in .Net Core Unit Testing.