开发者

how to serialize long to string with jackson?

开发者 https://www.devze.com 2023-01-27 06:48 出处:网络
jackson serializes long x = 1234 to开发者_JAVA百科 {x:1234} For several reasons I need {x:\"1234\"}

jackson serializes long x = 1234 to开发者_JAVA百科 {x:1234} For several reasons I need {x:"1234"}

any jackson annotation?

thanks.


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

@JsonSerialize(using=ToStringSerializer.class)
public long getId() {
    return id;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消