Skip to content

Allow registering "string-converter hook", for low-level coercion or String mutation #355

Description

@cowtowncoder

One common wish for processing (at various levels) is to be able to modify incoming String values, to either:

  1. Modify Strings themselves (trim whitespace, change casing etc), or
  2. Change type of scalar token reported (coercion): for example, change String value "12" into number 12 (int)

While such functionality is most often needed for formats like CSV and XML (and perhaps properties), it seems that due to needed across multiple formats this would really make sense as jackson-core functionality.

What probably makes sense is to try to figure out abstractions needed, interaction, but require implementations to wire actual activity. In fact, it is almost certainly impossible to do it efficiently and cleanly from within jackson-core itself (or from databind).
But it should be possible to implement it in core both for API, and wiring for JSON, and then add similar functionality for other textual (and maybe, if there's demand, for binary?) codecs.

Activity

  1. added
    3.xIssues to be only tackled for Jackson 3.x, not 2.x
    and removed on Aug 30, 2019
  2. cowtowncoder commented on Dec 5, 2020

    @cowtowncoder
    MemberAuthor

    Note: created jackson-databind issue too, to increase visibility.

  3. added
    most-wantedTag to indicate that there is heavy user +1'ing action
    on Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xIssues to be only tackled for Jackson 3.x, not 2.xmost-wantedTag to indicate that there is heavy user +1'ing action

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions