I want to serialize and deserialize an object to and from JSON. my
object looks something like this:

http://pastebin.com/yB5idwNq

This gives me an error that looks something like this:

System.Runtime.Serialization.SerializationException: Type 'MyObject1'
with data contract name 'MyObject1:http://schemas.datacontract.org/
2004/07/namespace' is not expected. Add any types not known statically
to the list of known types - for example, by using the
KnownTypeAttribute attribute or by adding them to the list of known
types passed to DataContractSerializer.

I am only using ISerializable because [Serializable] [DataContract]
would not work of course.

How do I do this? I don't want to change my objects. It is actually
important that I return the interface and not the implementation for
various reasons. What can be done?

Reply via email to