I am using the DataContractJsonSerializer class to serialise my objects to JSON.
Is there an attribute I can use on fields in my custom objects (C#) that will turn off serialisation for that one particular field?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually, there is a way: IgnoreDataMemberAttribute
See http://msdn.microsoft.com/en-us/library/system.runtime.serialization.ignoredatamemberattribute.aspx and http://msdn.microsoft.com/en-us/library/cc656732.aspx for full documentation.