int 属性 的序列化呈现为 double?
Serialization of int property is presented as double?
我有一个 属性 类型为 int
的基本 POJO。
...
@Json(name = "partner_id") int partner_id = 1;
...
序列化后,它在 JSON 中记录为:
...
"partner_id":1.0
...
如果我希望按照建模方式将 partner_id
发送为 int
,如何防止转换为 double
?
更新。我正在使用 moshi-jsonapi, a json:api-compliant fork of Square's Moshi.
@kirisetsz was kind enough to take the time to recognize this as a bug in his library, and published a fix。再次感谢!
我有一个 属性 类型为 int
的基本 POJO。
...
@Json(name = "partner_id") int partner_id = 1;
...
序列化后,它在 JSON 中记录为:
...
"partner_id":1.0
...
如果我希望按照建模方式将 partner_id
发送为 int
,如何防止转换为 double
?
更新。我正在使用 moshi-jsonapi, a json:api-compliant fork of Square's Moshi.
@kirisetsz was kind enough to take the time to recognize this as a bug in his library, and published a fix。再次感谢!