Paste Special – A Hidden Feature Revealed

There is a new function since Visual Studio 2012, which means, that it is also available in the recently released Visual Studio 2013. This pretty tiny, but really cool feature allows you to generate C# classes based on XML or JSON input data.

I am not only going to show you where the function hides, I will also show you an example to make sure you realize the power behind the functionality. Well, to be honest, the only thing you’ll gain is time. But isn’t it always about efficiency?! Yes it is, there we go with the example:

First of all we need some JSON or XML. I decided to take the following JSON as an example input:

Let’s generated a bunch of C# classes from this JSON. It is really simple if you know where the particular function hides within the menus of Visual Studio. Go to EDIT, Paste Special, Paste JSON as the following screenshot demonstrates:

What do we get? We get a full object graph, model or whatever you want to call it. As above, I will show you the result to make clear how it looks like:

What do you think about this feature? Do you think this is awesome?! I do, because if you have a large file that you need to access through a C# program, you’ll save much time. I hope this feature will save you at least the time you needed reading this blog post.

Claudio Bernasconi

Claudio Bernasconi is a professional software developer, Microsoft certified technology specialist, blogger, technology enthusiast and founder of CarParking Schweiz. Since 2010 he works for KMS AG in Lucerne, Switzerland.