Posts

Showing posts from January, 2015

Featured Post

Smart Product designer

Image
download and purchase link: https://alkanyx.com/item/49/Smart+Product+designer

Live preview : http://smartproductdesigner.000webhostapp.com/

Smart Product Designer is a  tool to create your own product and get directly from your website. It is well documented, very easy to customize and use. It is build using most advance technologies including javascript, jQuery and html5.
Features Choose different product from collectionAdd custom texts to product.Change text colorChange the size and font of the TextLet the user drag, move or remove elementsAdd images to product selected from art gallery or browse it from systemDesign both frontside and back-sideShows preview while designingDownload designVery easy to customize and useHere is the purchase link : https://alkanyx.com/item/49/Smart+Product+designer

JSON serialization

In JSON we must explicitly need to put an attribute before each field that needs to be serialized. Also we need to put [DataContract] attribute before the declaration of the class. Here is the sample code JSON serialization -
[DataContract] public class Employee { [DataMember] private int empId; [DataMember] public string empName; public void SetEmployeeId(int id) { empId = id; } } 
If you want to ignore any field then simply do not put [DataMember] attribute in front of that property. To serialize an object to JSON we can use DataContractJsonSerializer class from the namespace System.Runtime.Serialization.Json. Here is the sample code for JSON serialization -
Employee emp = new Employee(); emp.SetEmployeeId(1); emp.empName = "John"; Stream stream = new FileStream("Emp.json", FileMode.Create); DataContractJsonSerializer JsonSer = new  DataContractJsonSerializer(typeof(Employee)); JsonSer.WriteObject(stream, Employee); stream.Close(); The JSON for the employe object is : { "emp…