我正在使用改造并通过 post 方法向服务器发送请求
adreess class for post i m using this object
{
"years":"1855",
"months":"6",
"skills":1
}
now i have to implement array inside object in skills how to post this
{
"years":"1",
"months":"6",
"skills":["1","2","3"],
}
如何在改造中获取对象内部的数组 我正在使用这样的界面
Call<AddressResponce> address(@Body Adreess adreess);
最佳答案
package com.example;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Example {
@SerializedName("years")
@Expose
private String years;
@SerializedName("months")
@Expose
private String months;
@SerializedName("skills")
@Expose
private List<String> skills = null;
public String getYears() {
return years;
}
public void setYears(String years) {
this.years = years;
}
public String getMonths() {
return months;
}
public void setMonths(String months) {
this.months = months;
}
public List<String> getSkills() {
return skills;
}
public void setSkills(List<String> skills) {
this.skills = skills;
}
}
希望对你有用..!
关于android - 在改造中在 json 对象中发布数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44917803/