Microsoft Visual Studio | Generate Class from JSON or XML
I found an useful feature in visual studio to generate class from JSON or XML. In Visual Studio, you can copy JSON or XML text and then paste the text as classes in C#/VB.Net code file using following steps:
- Copy Your JSON: example:
{
"PersonId": 1,
"GoalId": 111,
"ActivityId": 1111,
"Task": {
"Name": "Task-1",
"Description": "Task-1 desc",
"ActivityScope": 5,
"ActivityType": 1,
"isCustomized": true
}
} - Select Edit > Paste Special and choose Paste JSON As Class:it will create class like this for the above JSON:
- Same can be done using XML Paste.
No comments:
Post a Comment