Articles → .NET → Paste JSON as classes in visual studio 2013

Paste JSON as classes in visual studio 2013






Create a sample JSON




{
  "Name": "Karan Gupta",
  "Age": 28,
  "Technology": "JSON",
  "Address": {
    "City": "Gurgaon",
    "State": "Haryana"
  }
}



Create a sample project




using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Demo {
	public class PasteJsonAsClasses {}
}




using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Demo {

}



Paste JSON as classes




Picture showing Paste JSON as classes option in visual studio 2013

Click to Enlarge



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Demo {

	public class Rootobject {
		public string Name {
			get;
			set;
		}
		public int Age {
			get;
			set;
		}
		public string Technology {
			get;
			set;
		}
		public Address Address {
			get;
			set;
		}
	}

	public class Address {
		public string City {
			get;
			set;
		}
		public string State {
			get;
			set;
		}
	}

}



Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, January 20, 2016

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250