Documentation > CMS Template API Library > Util > SerializeDataContractJson(Object)

SerializeDataContractJson

Define a class that uses [DataContract], [DataMember], and [EnumMember] tags and you can then serialize an instance of that class to JSON with this method Use the Name property in the DataMember to use a name that is different from the property name -- [DataContract(Name="MySpecialName")] Use the Namespace in the DataContract to use a namespace that is custom for XML -- [DataContract(Namespace = "MySpecialNamespace")]

public System.String SerializeDataContractJson(Object)



Parameters

NameDescriptionType
obj

System.Object

Code Example

C#

Sample:

Connect with Crownpeak