• Home
  • About me

DotNetSwede

A blog about .NET, C#, JavaScript and technology in general.

JSON

Convert JSON and XML to POCOs Automatically

11th February 2016 by Jonathan Lindkvist Leave a Comment

If you’re working against an API then you’ll probably get your data in either JSON or XML format. In order to deserialize those JSON and XML objects into their C# equivalents you’ll need actual POCOs to serialize to. Luckily, Visual Studio has built in functionality for this already.

How to convert JSON and XML to POCOs in Visual Studio

Edit > Paste Special > Paste JSON As Classes/Paste XML As Classes

That’s it! If you don’t feel like opening up Visual Studio then you can also use the online tool json2csharp which does JSON to C# POCO conversion online.

 

This feature is one of many “hidden” gems in Visual Studio that I love. 🙂

Posted in: Visual Studio Tagged: Convert JSON to POCO, JSON, POCOs, Visual Studio, XML

Recent Posts

  • Modular Monoliths
  • Clean Architecture
  • AngularJS to Angular Upgrade Paths
  • Web Scraping with C#
  • ASP.NET Core MVC Anatomy

Recent Comments

  • Dany Wehbe on Web Scraping with C#
  • rainadawan on Web Scraping with C#
  • Clean Architecture - How to Code .NET on Clean Architecture
  • Samuel Dass on Error Logging, Profiling and Analytics Tools for .NET Applications
  • Mokhtar Ebrahim on Web Scraping with C#

Archives

  • November 2018
  • January 2018
  • August 2017
  • July 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016

Categories

  • .NET
  • .NET News
  • Architecture
  • ASP.NET
  • Content Management Systems (CMS)
  • Fun
  • JavaScript
  • jQuery
  • Learning
  • Tools
  • Visual Studio
  • Webdesign

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2019 DotNetSwede.

Omega WordPress Theme by ThemeHall.