ServiceStack/ServiceStack.Text — pull request #201 by danielcrenna (2012-09-23 03:22:05+00:00)
Title: Ability to deserialize "this_property" -> "MyClass.ThisProperty" with runtime flag

For your consideration:

I use SST for HTTP client libraries, and most JSON on the planet is written lowercase_underscored. Currently SST requires exact matches such that "this_property" will not map to MyClass.ThisProperty, resulting in a null value. I know that this is worked around by declaring property names in a DataContract or using custom hooks to hijack BCL serialization, but considering how many APIs use the lowercase_underscore convention (i.e. 99% of the one's I've used), I wanted a way to do this and keep my POCO DTOs.

What I came up with is a simple intercept that switches the default TypeAccessor resolution at runtime with a static enum. Both strategies are created statically and switched during enum assignment, so there shouldn't be a performance hit for the default value unless there's some inlining situation I'm not thinking of.