Timeline for JSON.NET - exclude properties of a specific type at runtime
Current License: CC BY-SA 3.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 29, 2012 at 19:29 | answer | added | Levitikon | timeline score: -1 | |
| Aug 25, 2011 at 1:39 | history | edited | Piotr Szmyd | CC BY-SA 3.0 |
edited title
|
| May 28, 2011 at 12:52 | vote | accept | Piotr Szmyd | ||
| May 27, 2011 at 20:43 | comment | added | Piotr Szmyd | @Jamie: Yes, I know the exact types to exclude | |
| May 27, 2011 at 18:59 | comment | added | Jamie Thomas |
Do you know the type of the dynamic property values themselves? For example, are they instances of DynamicObject or some other known type implementing IDynamicMetaObjectProvider or are they also completely random classes from other libraries not known at design time?
|
|
| May 27, 2011 at 18:48 | comment | added | Piotr Szmyd | @Jamie: That'd be perfectly sufficient, yes. They are not going to be de-serialized to .NET objects, but only reused client-side in JS. | |
| May 27, 2011 at 18:42 | comment | added | Jamie Thomas | Is it sufficient to your need to not completely exclude these properties by instead to serialize them as empty objects? So a property named Foo whose instance is dynamic would be serialized as Foo: {} | |
| May 27, 2011 at 17:37 | comment | added | Piotr Szmyd | Exactly that! The root object I'm serializing can be anything, but sometimes it may have a dynamic property (which references some IDynamicMetaObjectProvider object, or a collection of some), which I want to exclude from serialization. Serialized object is not dynamic, only the excluded property/ies are. | |
| May 27, 2011 at 17:27 | comment | added | Jamie Thomas |
So, to clarify, you want to exclude from serialization properties whose values implement IDynamicMetaObjectProvider? I am very familiar with dynamic types, but I am unsure in your case what you are actually serializing. It sounds like you are serializing normal classes and want to exclude certain properties on these that reference dynamic instances. At the same time you also indicated that you do not know the types, or base types, of the items you are serializing--just that they occasionally reference properties that are dynamic and cannot be serialized. Please post a simple example.
|
|
| May 27, 2011 at 13:33 | history | edited | Piotr Szmyd | CC BY-SA 3.0 |
added 708 characters in body
|
| May 27, 2011 at 2:49 | answer | added | James Newton-King | timeline score: 2 | |
| May 27, 2011 at 0:48 | answer | added | Jamie Thomas | timeline score: 5 | |
| May 27, 2011 at 0:34 | history | edited | Piotr Szmyd | CC BY-SA 3.0 |
edited body
|
| May 27, 2011 at 0:25 | history | asked | Piotr Szmyd | CC BY-SA 3.0 |