Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonAnyGetter doesn't work with JsonSerialize (except with keyUsing) #705

Closed
natnan opened this issue Feb 16, 2015 · 1 comment
Closed

Comments

@natnan
Copy link

natnan commented Feb 16, 2015

(This is happening with 2.5.0. Haven't tried 2.5.1 but I couldn't see any related issue anyway)

Jackson ignores JsonSerialize annotation when there is JsonAnyGetter annotation.

  @JsonSerialize(using = MySerializer.class)
  // or
  @JsonSerialize(converter = MyConverter.class)
  @JsonAnyGetter
  public Map<String, String> getParameters(){
    return parameters;
  }

except

@JsonSerialize(keyUsing = MyKeySerializer.class)

(haven't tried each setting. Only tried keyUsing because I've seen a different issue (#661) with it)
Then it works. But I need the converter, so..

For the time being I will use

  @JsonAnyGetter
  public Map<String, JsonNode> getParameters(){
    return new MyConverter().convert(parameters);
  }

but I'd prefer to stick to annotations.

@cowtowncoder
Copy link
Member

Thank you for reporting this.

@cowtowncoder cowtowncoder added this to the 1.9.13 milestone Feb 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants