Skip to content

Proposal: use NamingStrategy from Newtonsoft.Json #718

Closed
@bart-degreed

Description

@bart-degreed

Today we have our own IResourceNameFormatter to apply casing conventions for resource names, attributes and query string parameters. And we have custom implementations for camel case and kebab case.

Instead of having our own, I'd like to reuse the ones that ship with the Newtonsoft.Json library (currently kebab case, camel case and snake case). This would enable the next setup using options:

options.SerializerSettings = new JsonSerializerSettings
{
    ContractResolver = new DefaultContractResolver
    {
        NamingStrategy = new KebabCaseNamingStrategy()
    }
};

Today we already heavily depend on the Newtonsoft.Json library, which I don't expect to change anytime soon as System.Text.Json is relatively young and lacks support for many features.

So I think now is not the time to abstract away from Newtonsoft.Json, which you'll need anyway if you want to configure things like enum string conversion, culture settings, tracing, timezone handling, dealing with circular references etc. Once System.Text.Json reaches feature parity, we'll have a better understanding how to support multiple serialization libraries and the right way to abstract settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions