Introduction
In this article, I will show you a very interesting feature of Visual Studio. which is we can paste our JSON and XML as a class after copying that JSON or XML. In simple terms, if we have some JSON data or XML data and we want to generate classes for that data then Visual Studio has a feature for that. In that we will just copy the JSON data and when we paste the classes for JSON or XML it will be automatically generated.
In this article, I will show you a very interesting feature of Visual Studio. which is we can paste our JSON and XML as a class after copying that JSON or XML. In simple terms, if we have some JSON data or XML data and we want to generate classes for that data then Visual Studio has a feature for that. In that we will just copy the JSON data and when we paste the classes for JSON or XML it will be automatically generated.
Let us see how it is possible:
Pasting JSON as Classes
Suppose I have the following JSON data:
- {
- "Employees": [
- {
- "userId": "rirani",
- "jobTitleName": "Developer",
- "firstName": "Romin",
- "lastName": "Irani",
- "preferredFullName": "Romin Irani",
- "employeeCode": "E1",
- "region": "CA",
- "phoneNumber": "408-1234567",
- "emailAddress": "[email protected]"
- },
- {
- "userId": "nirani",
- "jobTitleName": "Developer",
- "firstName": "Neil",
- "lastName": "Irani",
- "preferredFullName": "Neil Irani",
- "employeeCode": "E2",
- "region": "CA",
- "phoneNumber": "408-1111111",
- "emailAddress": "[email protected]"
- },
- {
- "userId": "thanks",
- "jobTitleName": "Program Directory",
- "firstName": "Tom",
- "lastName": "Hanks",
- "preferredFullName": "Tom Hanks",
- "employeeCode": "E3",
- "region": "CA",
- "phoneNumber": "408-2222222",
- "emailAddress": "[email protected]"
- }]
- }

Deepak SelvarajPosted Aug 14, 2018, 4:28 AM
Hello i followed your steps.. but it says "login event received from localhost but no credentials provided"
Bhuvanesh MohankumarPosted May 3, 2016, 12:53 PM
Good one..
Humayun Kabir MamunPosted Apr 17, 2016, 2:22 AM
Nice...
Kuppurasu NagarajPosted Apr 14, 2016, 9:26 AM
Nice Sharing..
Vignesh ManiPosted Apr 14, 2016, 8:14 AM
Good
Rahul Kumar SaxenaPosted Apr 14, 2016, 6:26 AM
Good Sourabh Somani
Debasis SahaPosted Apr 13, 2016, 1:44 PM
Nice one..
Mohammed IbrahimPosted Apr 13, 2016, 1:13 PM
nice
Ravi PatelPosted Apr 13, 2016, 8:55 AM
useful thanks for nice article
Ramchand RepallePosted Apr 13, 2016, 8:48 AM
Good one..
Ranjan DailataPosted Apr 13, 2016, 7:27 AM
Alternatively, one can use free JSON to C# Converter - http://json2csharp.com/
Gowtham RajamanickamPosted Apr 13, 2016, 7:23 AM
congrats on your 100+ articles
Gowtham RajamanickamPosted Apr 13, 2016, 7:22 AM
nice one...
jasmin patelPosted Apr 13, 2016, 6:38 AM
Nice example
Shakti Singh DulawatPosted Apr 13, 2016, 6:08 AM
Congratulations to you on your 101 articles Journey
Shaili DashoraPosted Apr 13, 2016, 4:32 AM
Nice one..