Skip to content

Document why Jackson annotations on types are not used for JSON serialization #321

Closed
@mikovsky

Description

@mikovsky

Hello!
Is there any way to wire a custom JsonSerializer to the spring-graphql? I have a custom serializer for setting the precision of double values. For example:

class Response {
    @JsonSerialize(using = CustomFormatter::class)
    @Precision(2)
    val number: Double,
}

If for example, number has a value 2.8503471831075 it will shrink precision to the 2.85.
I have a similar serializer for an application with rest api using JsonSerializer and ContextualSerializer, but I can't make it work in a project with spring-graphql. Maybe there is a different way to achieve this functionality?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions