20

jackson serializes long x = 1234 to {x:1234} For several reasons I need {x:"1234"}

any jackson annotation?

thanks.

ramon_salla
  • 1,587
  • 1
  • 17
  • 35

1 Answers1

34

The following annotation could be used to serialize a long as a string:

@JsonSerialize(using=ToStringSerializer.class)
public long getId() {
    return id;
}
fgui
  • 1,564
  • 1
  • 13
  • 14