ServiceStack/ServiceStack.Text — pull request #432 by pavelsavara (2014-10-20 12:54:34+00:00)
Title: This change allows to work with existence of the attribute on the Json m...

This change allows to work with existence of the attribute on the Json message in same way as dynamic languages do.
(after deserialization to JavaScript for example you could test field existence by hasAttribute() function).

Changes:
- support for conditional serialization with method ShouldSerializeByName on DTO found by convention.
- The difference to existing ShouldSerializeX is that it could handle all fields not just one.
- It returns nullable bool with following meaning: True- should be on the json. False - should not be on the JSon. Null - use behavior defined by configuration and DataMemberAttribute

- support for attribute on wire detection with method OnDeserializingMember on DTO found by convention.
- it complements ShouldSerializeByName and allows to implement full roundtrip of existence of the field on the JSon message.
- it's designed in a way which allows event handler to change the deserialized object value before it's assigned to target field (by return value of the handler).
- it will give raw json string for fields which don't have member on the DTO, allowing to implement parallel to IExtensibleDataObject for Json. It allows survival and forwarding of unknown attributes.