I recently have been working on project where I have been evaluating some vendor APIs. Across the multiple vendors the responses have been in either XML or JSON. Since I am most familiar with .NET development, I have been creating my testing clients in C# after verifying the responses from the API with Fiddler. So in many cases once I have seen the XML/JSON output, I want to be able to download that data into my application as a class. Thankfully, the Web Essentials Visual Studio extension by Mads Kristensen, includes two excellent options. Paste XML As Classes and Paste JSON As Classes. With these two options ( from the File->Paste Special menu) when you have a class open you can paste any JSON or XML object and the extension will generate a class that corresponds to the document for you. In some cases (especially with XML) you may need to perform some additional clean up of local variable names, etc. But in the long run this has saved me lots of keystrokes. Below are a couple of examples.
JSON Object
Corresponding Class created with Paste JSON as Classes
XML Object
Corresponding Class created with Paste XML as Classes
As I stated earlier, the variable names in the classes created for this XML object could use a little clean up, but with a good refactoring tool, this should not be a difficult task and something that I find much more enjoyable than creating the entire file by hand.
Hope that you find this useful and that it can save you some time.
7 comments:
This guy might be crazy - but his first name really isn't "Mad" - but rather "Mads" ...
You are correct, his name is Mads. Thanks for pointing out the typo, this has been corrected.
Your tutorials are very good. I wish you would do more C#.
Maybe do a longer project with winforms. Or now when it starts to take off make some universial windows 10 apps.
I wouldent mind if you would make a longer project with a more usefull program. From the start how to plan it all and then how to program it. I would love if you could do something like a poker game or poker hand evaluator. That is my personal preference, but any longer project would be cool :-)
Please add the link to the previous and next video in this series. Very helpful but killing me with the order. They do not show up in order in the video list. Spent lots of time searching for the next step/video in the series. Thanks
Very good, very clear - thanks for taking the time to make and post. I loved the cheering crowds, and taking everything from first principals is very helpful. I feel that many tutorials ignore such 'trivial' steps, and this seeps into them then missing the important ones too, or skimming over them.
Hey there! I realize this is sort of off-topic but I needed to ask.
Does building a well-established website like yours require
a massive amount work? I'm brand new to operating a blog but I do write in my diary every day.
I'd like to start a blog so I can share my own experience and views online.
Please let me know if you have any kind of recommendations or tips for brand new aspiring blog owners.
Appreciate it!
Thank you so much for this useful information. looking more from your side to update us on more updates and advancements
Post a Comment