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

Support to set logical property when working with JsonSubTypes

    Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0
    • Component/s: Deserializer
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I would like to request a feature where the property used for JsonTypeInfo to indicate JsonSubTypes could be set a logical property on the object aswell.

      Here is the email between me and Tatu

      > Hi Tatu,
      > > That worked out great.
      > >
      > > Another quick question, is it possible to also set a field on the class when
      > > the deserialization happens. We have a enum called on Type on PriceSheetItem
      > > and I would like that varaible set aswell as creating right type of an
      > > object. I know technically I can just hardcode in the sub types to return
      > > the right implementation, but wondering if something like this is possible.

      There is no way to automatically do that at this point. Could be a new
      feature to add; indicate logical property to set with type string (or
      enum since that is easy to convert to).
      If you think that is a good idea, feel free to add Jira feature request.

      + Tatu +

        Activity

        Hide
        Tatu Saloranta added a comment -

        Ok: added @JsonTypeInfo.visible property (defaults to false): when set to true, Jackson will now put type id property in JSON and it will then be normally bound to whichever property matches. Works with all embedding styles, all property types (including creator properties).

        Show
        Tatu Saloranta added a comment - Ok: added @JsonTypeInfo.visible property (defaults to false): when set to true, Jackson will now put type id property in JSON and it will then be normally bound to whichever property matches. Works with all embedding styles, all property types (including creator properties).

          People

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

            Dates

            • Created:
              Updated:
              Resolved: