Skip to content

[FEATURE] Support for custom JsonSerializerOptions #7238

Closed
@ilya-scale

Description

@ilya-scale

Is your feature request related to a problem? Please describe.
I am trying to switch to the new library 8.x, but it does not seem it allows for custom format for Json serialization.

E.g. I need to add a date format, enum conversion, camel case, etc.

Before it was possible to do this:

var connectionSettings = new ConnectionSettings(pool, (serializer, values) =>
{
            return new JsonNetSerializer(serializer, values, () => MySettings); 
}

I did not find anything on how to do it in 8.x.

Describe the solution you'd like
I want a possibility to provide my own options. If required it should be merged with DefaultRequestResponseSerializer if it has some options that have to be present.

Describe alternatives you've considered
It seems it is possible to get to the Options of the default serialiezr like that:

var jsonSerializerOptions = ((SystemTextJsonSerializer) client.RequestResponseSerializer).Options;

I am not sure if it is intended, but it is not possible to replace the options completely, but possible to augment them. It seems a bit strange way of accessing the options and looks more like a side effect than a feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions