Jackson JSON Processor
  1. Jackson JSON Processor
  2. JACKSON-292

Add @JsonAnyGetter for serialization (similar to @JsonAnySetter for deserialization)

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.2
    • Fix Version/s: 1.6
    • Component/s: Serializer
    • Labels:
      None
    • Number of attachments :
      0

      Description

      (idea came via jackson-users.ning.com discussion, suggested by Henrik Lundgren)

      It would be nice to be able to do inverse of @JsonAnySetter – define a method that returns a Map (or possibly just collection of Map.Entry instances, or even just iterator?) and entries would be serialized as main-level attributes of enclosing object on serialization.

      Although it would be possible to further generalize this idea (@JsonUnwrap?), for now it may be best value for development time to implement this in more limited form.

        Activity

        Hide
        Tatu Saloranta added a comment -

        Note: JACKSON-132 is related; this issue can be seen as subset of it.

        Also, note that both @JsonAnyGetter and @JsonAnySetter should be applicable to Map fields.

        Show
        Tatu Saloranta added a comment - Note: JACKSON-132 is related; this issue can be seen as subset of it. Also, note that both @JsonAnyGetter and @JsonAnySetter should be applicable to Map fields.
        Hide
        Tatu Saloranta added a comment -

        Implemented in trunk, for 1.6.0. Initially will only support Map-returning methods, did not expand to support fields or bean types (for any-getter where this could be done theoretically).
        Can be expanded if and when actually needed by an user.

        Show
        Tatu Saloranta added a comment - Implemented in trunk, for 1.6.0. Initially will only support Map-returning methods, did not expand to support fields or bean types (for any-getter where this could be done theoretically). Can be expanded if and when actually needed by an user.

          People

          • Assignee:
            Tatu Saloranta
            Reporter:
            Tatu Saloranta
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: