Description
The ClientConfiguration has two properties for controlling serialization/deserialization: SerializationSettings and DeserilizationSettings. By default they use CamelCasePropertyNamesContractResolver, which is provided by NewtonSoft. In some cases, the user may want to store the JSON in camel-cased (JS convention) and then convert it to Pascal cased when hydrating POCOs (pascal cased in the C# convention). By providing an optional PascalCasePropertyNamesContractResolver, this should be possible.
To create a custom Contrac resolver, you need to derive from DefaultContractResolver and override the ResolvePropertyName method. Here is an example: http://stackoverflow.com/questions/18051395/custom-json-net-contract-resolver-for-lowercase-underscore-to-camelcase
Note, you may want to spend some time googling this to see if someone has created a solid implementation, since it's a fairly common feature.
Attachments
For Gerrit Dashboard: NCBC-739 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
44355,4 | NCBC-739: Test handling Casing in Json transcoding | master | couchbase-net-client | Status: MERGED | +2 | +1 |
44377,2 | Fix build csproj somehow not committed previously | master | couchbase-net-client | Status: MERGED | +2 | +1 |