Serializing Anonymous DataMemeber

I've been working win MVC Web API and encountered an annoying problem. It does not, by default serialize anonymous data members.

When you try to serialize this kind of data you get this beautiful exception:

Converting anonymous type to a string also caused exception. But there is also JavaScriptSerializer:

Now using getter, I tried combining the two:

That seems to have done the trick.

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box