你好,因为业务需要特殊的处理,淘宝SDK java对象的字段是驼峰,C#对象的字段是大写开头,SDK有@ApiField标签,nutz json能实现json字符串的相互转换吗?或者根据自定义注解去实现
6 回复
类已经封装在SDK里面了,无法插入@JsonField,能否指定注解为@ApiField,先不考虑faster json的Serializer
public class WlbWaybillISearchResponse extends TaobaoResponse {
private static final long serialVersionUID = 4773645678145939655L;
@ApiListField("subscribtions")
@ApiField("waybill_apply_subscription_info")
private List<WaybillApplySubscriptionInfo> subscribtions;
public WlbWaybillISearchResponse() {
}
public void setSubscribtions(List<WaybillApplySubscriptionInfo> subscribtions) {
this.subscribtions = subscribtions;
}
public List<WaybillApplySubscriptionInfo> getSubscribtions() {
return this.subscribtions;
}
}
namespace Top.Api.Domain
{
[Serializable]
public class WaybillApplySubscriptionInfo : TopObject
{
[XmlArray("branch_account_cols"), XmlArrayItem("waybill_branch_account")]
public List<WaybillBranchAccount> BranchAccountCols
{
get;
set;
}
[XmlElement("cp_code")]
public string CpCode
{
get;
set;
}
[XmlElement("cp_type")]
public long CpType
{
get;
set;
}
[XmlElement("result")]
public long Result
{
get;
set;
}
}
}
那估计不行了, @JsonField注解的逻辑是写在 org.nutz.json.entity.JsonEntityField.eval(Mirror<?>, Field) 里面的,没有考虑自定义json的需求
创建个新类?
来自美丽的 NutzCN
添加回复
请先登陆