This project is read-only.

Support for DynamicObject and/or ExpandoObject?

Dec 16, 2011 at 5:10 PM

Would be great to get full dynamic support by adding a special serialization for objects implementing IDictionary<string, Object>, and another for objects extending DynamicObject (using GetDynamicMemberNames to retreive the member list)

The current support for anonymous types is great, but limited to creating properties in the initializer. It'd be cool to be able to do:

 

dynamic person = new ExpandoObject();

person.FirstName = "John";

if(someCondition)
{
    person.Department = new {
         Name = "foo"
    }
}

...and serialize it to { FirstName:"John", Department: { Name : "foo"} }
instead of 
{ { Key : "FirstName", Value :"John" }, { Key : "Department", Value: { Name : "foo"} } }

 

Feb 21, 2013 at 1:37 AM
+1