Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-739

Add PascalCasePropertyNamesContractResolver for serialization/deserialization

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 2.0.1
    • 2.0.0
    • library
    • None

    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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            simonbasle Simon Baslé (Inactive)
            jmorris Jeff Morris
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty