Android 安卓截击中如何发送参数数组

Android 安卓截击中如何发送参数数组,android,android-studio,android-layout,android-fragments,android-volley,Android,Android Studio,Android Layout,Android Fragments,Android Volley,我想使用凌空API将数据传递给服务器。这些参数可能类似于: Request: { "user_id" : 6, "package_name": "Personal Package", "care_type" : ["help in shopping", "Personal care"], "care_delivered" : "as day care", "gender" : "F", "experience" : "4,0", "skil

我想使用凌空
API
将数据传递给服务器。这些参数可能类似于:

Request:
{
    "user_id" : 6,
    "package_name": "Personal Package",
    "care_type" : ["help in shopping", "Personal care"],
    "care_delivered" : "as day care",
    "gender" : "F",
    "experience" : "4,0",
    "skills":"very helpful , caring, etc",
    "start_date" : "2018-09-12",
    "price": "200-700, day",
    "description": "test"
}
在此
中,care\u type
是一种数组类型。我已经做了代码发送数据,但每次我得到的错误,即

onErrorResponse: Error: org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
onErrorResponse:Error:org.json.JSONException:Value使用:

HashMap params=newhashmap();
对于(int i=1;i使用:

HashMap params=newhashmap();

对于(int i=1;i,使用以下代码发布数组

JSONArray care_type = new JSONArray();
for(int i=0; i < yourarray.length(); i++) {
    care_type.put(yourarray[i]);   // create array and add items into that 
}
params.put("care_type",care_type.toString());
JSONArray care_type=new JSONArray();
对于(int i=0;i
要发布数组,请使用下面的代码

JSONArray care_type = new JSONArray();
for(int i=0; i < yourarray.length(); i++) {
    care_type.put(yourarray[i]);   // create array and add items into that 
}
params.put("care_type",care_type.toString());
JSONArray care_type=new JSONArray();
对于(int i=0;i
在JSONArray中添加您的数组,并使用密钥名将其发送到

JSONArray dataObject=新的JSONArray(filterListing); paramObject.put(“数据”,dataObject)

在JSONArray中添加您的数组,并使用密钥名将其发送到

JSONArray dataObject=新的JSONArray(filterListing);
paramObject.put(“data”,dataObject);

仍然得到smae错误。这段代码中的列表是什么。是的,我在其中使用了strArr,但仍然得到相同的错误。是的,我已经转换,但在服务器端php开发人员为其分配了数组类型。我检查了两者是否相同{price=400-1000,hour,description=,skills=dguj,care_delivered=as live-in-care,start_date=2018-12-29,care_type=[“个人护理”、“陪伴”、“日常生活帮助”、“移动帮助”、“痴呆症护理”],性别=F,用户id=4,体验=fguuh,套餐名称=fguuuuh}仍然收到smae错误。此代码中的列表是什么。是的,我在其中使用了strArr,但仍然收到相同的错误。是的,我已转换,但在服务器端php开发人员为其分配了数组类型。我检查了两者是否相同{price=400-1000,hour,description=,skills=dguj,care_delived=as live in care,start_date=2018-12-29,care_type=[“个人护理”,“陪伴”、“日常生活帮助”、“行动帮助”、“痴呆症护理”]、性别=F、用户id=4、体验=FGUUUH、套餐名称=FGUUUH}
 JSONArray jsonObject=new JSONArray();
 for(int i=1;i<=size;i++)
 {
    arr[i]="userId_"+i+"_"+"ans_"+i;
    jsonObject.put("params_"+i,arr[i]);
 }

HashMap<String ,String> params=new HashMap<String, String>();
params.put("params",jsonObject.toString());
JSONArray care_type = new JSONArray();
for(int i=0; i < yourarray.length(); i++) {
    care_type.put(yourarray[i]);   // create array and add items into that 
}
params.put("care_type",care_type.toString());