If you're working with JSON, say for REST web services, and you don't have the class to unmarshal the response, Visual Studio can automatically generate the class for you:
- Open your Visual Studio Project and create a class file. Delete the contents:
- Copy the JSON text string you will need to unmarshal onto the clipboard. Take this example from the JSON Placeholder mock API:
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
- Go to Edit > Paste Special > Paste JSON as Classes: The result is a class named "Rootobject" that you can use to unmarshal the information on your code.
Original post is here.
Top comments (0)