【发布时间】:2016-07-26 23:48:00
【问题描述】:
我正在尝试通过改造 2 发布,坐标,示例:
name="geo" {"date":"2016-03-28 18:15:22","lat":65.9667,"long":-18.5333}
你能帮帮我吗?我有, 型号:
public class LocationCoordinatesEntity{
@SerializedName("long")
@Expose
private Double longitude;
@SerializedName("lat")
@Expose
private Double latitude;
@SerializedName("date")
@Expose
private Date date;
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public LocationCoordinatesEntity(Double longitude, Double latitude, Long date){
this.latitude = latitude;
this.longitude = longitude;
this.date = new Date(date);
} }
和
@Multipart
@POST("setgeojson")
Observable<Void> setgeoMultipart(@Part("geo") String geo);
和
Observable<Void> sendMultipartObservable = apiInterface.setgeoMultipart(gson.toJson(coordinatesEntity));
当我要发布这个时,我得到一个错误:
java.lang.IllegalStateException: JSON must start with an array or an object.
【问题讨论】:
-
你为什么使用
multipart目的是什么?
标签: android json post multipart retrofit2