Wednesday, March 20, 2013

Json Serialization Bug in .NET w/ Json.NET

I tried to conditionally serialize an object to Json using the ShouldSerialize function method described here.  It didn't work because I defined the ShouldSerialize functions as members of a child class and the reflection code is using only the DeclaringType to look up the ShouldSerialize methods.  Using a ContractResolver worked around the bug.

No comments: