James Montemagno
James Montemagno

Live, Love, Bike, and Code.



James Montemagno

Convert Json to C# (and More) with quicktype

James MontemagnoJames Montemagno

How often do you run into the situation where you are reading data from a json file or hitting a RESTful endpoint and pulling down a huge json file that you then need to deserialize? I bet pretty often as I know I do all the time. The next issue of course is that you have this bug json file, but you need to generate the actual data types, POCOs, inside of your C# code. This can be extremely tedious if you try to do it by hand and other websites give you lack luster C# files where you have to add in JsonProperty attributes, Serializers, and Converters. Well not any more with quicktype.io, which just launched today.


What is quicktype?

When you head to quicktype.io you are greeted with a nice and friendly layout where you can input your json on the left and output to any language on the right. The site gives you some very nice default json types such as reddit and a pokedex to get started and then you pick what language:


Once you select your language it will remember it for future use, but they already support C#, TypeScript, Go, Java, Elm, and Swift in addition to a Schema and Simple Type output.

At any point you can just delete the json that is displayed and enter anything yourself. Modifying the Top-level type will update the code with whatever you want the base class to be. #MindBlown

Who is it by?

Awesome amazing people that I have worked with for many years. Mark Probst and David Siegel have been working on this project for some time now and have been developing it completely in the open on GitHub. I have to tip my hats as they have solved a problem that just about every developer runs into on a daily basis.

quicktype in Action

Live, Love, Bike, and Code