I've been working a little bit here and there on a mobile app. One thing this app does a lot is use a RESTful API over HTTP, where the results are JSON.
I'm using RestSharp to handle these requests, and RestSharp can automatically serialize Json results into C# object(s), assuming I have C# objects that match.
Well, some of these JSON results can be a little complex. Not terribly complex, mind you, but enough to where it's annoying to create the classes myself. But I thought to myself, maybe there's a tool out there that already does this for me. I googled around and found json2csharp, which is a handy web app that does exactly that.
Well, thanks to Rob Gibbens, I now know that this feature is actually built-in to Visual Studio 2013, and available for 2012 as part of "ASP.NET and Web Tools".
You can see that there are some differences, but these tools get you most of the way there!
Grrr, where was this when I was mapping the new Twitter API JSON responses...
Thanks for the tip.
A little update here: if you use the "Paste Special" in Visual Studio, note that it uses arrays. However, if you try to use these on RestSharp, you'll get an error. For RestSharp, you'll need to use List<T>
I really could have used this earlier last week. Glad to know it is there, though. Thanks!
Matthew D. Groves lives in Central Ohio. He works remotely, loves to code, and is a Microsoft MVP.