This post was most recently updated on March 15th, 2016
Here’s a simple example:
A) Copy to clipboard your JSON object.
1 2 3 4 5 6 7 8 9 |
{ "link": "http://www.microsoft.com/Surface/en-US", "virtual": "Virtual Keyboard", "partial": " The magnesium panels are finished with partial vapor deposition", "Price": 499.99, "title": "Microsoft Surface", "Like": true, "cdDrive":null, } |
B) In VS2012, open edit menu, choose ‘Past Special’ and click on ‘Past JSON As Classes’.
The result:
1 2 3 4 5 6 7 8 9 10 |
public class Rootobject { public string link { get; set; } public string _virtual { get; set; } public string partial { get; set; } public float Price { get; set; } public string title { get; set; } public bool Like { get; set; } public object cdDrive { get; set; } } |
Of course it also supports more complex objects like Multi-Dimensional Arrays etc.