Skip to content

Allow configuring a default serialization and deserialization view (3.x) #5575

@reda-alaoui

Description

@reda-alaoui

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

Using version 2, I was able to setup a default view the following way:

objectMapper.setConfig(objectMapper.getSerializationConfig().withView(Views.Public.class));
objectMapper.setConfig(objectMapper.getDeserializationConfig().withView(Views.Public.class));

Using version 3, there seems to be no way to do the same. I can only set a view while building an ObjectReader or ObjectWriter. But in an environment such as Spring Boot 4, the shared and easy to preconfigure object is an instance of ObjectMapper.

Would it be possible to allow configuring a default view via JsonMapper.Builder or its parent?

Version Information

3.0.3

Reproduction

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xIssues to be only tackled for Jackson 3.x, not 2.x

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions